Обсуждение: invalid type internal size -1
I all,
I'm tryng to declare my email type.
I think I have to do it in this way:
create type email ( INPUT = email_in, OUTPUT = email_out, RECEIVE = email_recv,
SEND = email_send, INTERNALLENGTH = VARIABLE, PASSEDBYVALUE = f,
ALIGNMENT = int4 );
however I get:
ERROR: invalid type internal size -1
In the doc is written:
Base data types can be fixed-length, in which case internallength is a positive integer, or variable
length, indicated by setting internallength to VARIABLE. (Internally, this is represented by setting
typlen to -1.)
I'm doing this on Postgres 7.4.1
Am I missing something ?
Regards
Gaetano Mendola
Gaetano Mendola <mendola@bigfoot.com> writes:
> create type email ( INPUT = email_in,
> OUTPUT = email_out,
> RECEIVE = email_recv,
> SEND = email_send,
> INTERNALLENGTH = VARIABLE,
> PASSEDBYVALUE = f,
> ALIGNMENT = int4 );
> ERROR: invalid type internal size -1
There's a case in the regression tests for making a type with
internallength = variable, so I hardly think the facility is broken
entirely. Could we see a self-contained test case?
regards, tom lane
Gaetano Mendola <mendola@bigfoot.com> writes:
> create type email ( INPUT = email_in,
> OUTPUT = email_out,
> RECEIVE = email_recv,
> SEND = email_send,
> INTERNALLENGTH = VARIABLE,
> PASSEDBYVALUE = f,
> ALIGNMENT = int4 );
Oh, actually the problem is that PASSEDBYVALUE does not take an
argument, so you are declaring the thing as passed-by-value, which
is wrong. Leave out the PASSEDBYVALUE line altogether.
The CREATE TYPE parser should probably be tightened so it complains
about the above. I'll see what I can do about it.
regards, tom lane