Re: [GENERAL] type aliases

2014-02-15 Thread Tom Lane
David Johnston writes: > James Harper wrote >> So suppose I wanted to implement myvarchar in C. In my _in function, how >> do I know how big my column declaration is? Eg if someone tries to insert >> 50 characters into my 42 character field, how do I get the declared length >> and then tell postgr

Re: [GENERAL] type aliases

2014-02-15 Thread David Johnston
James Harper wrote >> >> You probably should define your domain like this: >> >>CREATE DOMAIN myvarchar varchar(42); >> > > That's what I thought, so it won't do what I want. I need to be able to > set the length at the time of declaration. > > So suppose I wanted to implement myvarchar in

Re: [GENERAL] type aliases

2014-02-15 Thread James Harper
> > You probably should define your domain like this: > >CREATE DOMAIN myvarchar varchar(42); > That's what I thought, so it won't do what I want. I need to be able to set the length at the time of declaration. So suppose I wanted to implement myvarchar in C. In my _in function, how do I

Re: [GENERAL] type aliases

2014-02-15 Thread Behrang Saeedzadeh
You probably should define your domain like this: CREATE DOMAIN myvarchar varchar(42); Best regards, Behrang http://www.behrang.org On Sat, Feb 15, 2014 at 6:23 PM, James Harper wrote: > I can create an alias of a type like: > > CREATE DOMAIN myvarchar varchar; > > But I can't declare a my