Help | Site Map
Connecting Tech Pros Worldwide
 
 
LinkBack Thread Tools
  #1  
Old November 23rd, 2005, 12:25 AM
Vinay Jain
Guest
 
Posts: n/a
Default Create Type Problem

Hi
I am newbie so this problem may be too simple to be asked.please help me if
any new thing to be added in following:

I want to use user defined data type in User_Type(n) way....

I created data type IndChar The c functions are:
/* Definaton of Data Type) */

typedef struct IndChar
{
int32 len;
char c_in_str[1];
}IndChar;

then i defined input & output functions.

Input: Datum indcharin(PG_FUNCTION_ARGS);
Output: Datum indcharout(PG_FUNCTION_ARGS);

then i created a function of the same name(i.e. IndChar) as
Datum indchar(PG_FUNCTION_ARGS);//for applying indchar(n) form i.e.fixed length
and i created it using:

create function indchar(IndChar, integer) returns IndChar
language C as 'Path for indchar.so file'
immutable strict;

after these i created data type using:
create type indchar
(input = indcharin,
output = indcharout,
internallength = variable,
storage = extended);

the type is created...

when i use it in Creating Table:

create table temp
(name IndChar(20));

it gives error at character '( '.....
please tell me why it is giving such error...
if some steps needed to alter or add tell me...
thanx in advance
Vinay jain
  #2  
Old November 23rd, 2005, 12:27 AM
Stephan Szabo
Guest
 
Posts: n/a
Default Re: Create Type Problem


On Thu, 1 Apr 2004, Vinay Jain wrote:
[color=blue]
> I am newbie so this problem may be too simple to be asked.please help me if
> any new thing to be added in following:
>
> I want to use user defined data type in User_Type(n) way....[/color]

AFAIK, you cannot currently make user defined types that
take (n) fashion arguments like varchar or numeric.

---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

http://archives.postgresql.org

 

Bookmarks

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over network members.
Post your question now . . .
It's fast and it's free

Popular Articles