Re: [HACKERS] Re: atttypmod of 0 - Mailing list pgsql-hackers

From Bruce Momjian
Subject Re: [HACKERS] Re: atttypmod of 0
Date
Msg-id 199802051741.MAA04033@candle.pha.pa.us
Whole thread Raw
In response to Re: atttypmod of 0  (Zeugswetter Andreas DBT <Andreas.Zeugswetter@telecom.at>)
List pgsql-hackers
>
>    This  time  it's during the parser (gdb told me). varcharin()
>     is called with a atttypmod of  0  causing  a  palloc()  of  0
>     bytes.  How should a VARCHAR type whithout a specified length
>     behave? Is this type 1 character or a  variable  size  up  to
>     4096?
>
> I thought we fixed this on Feb 3. look at
> parse_expr.c line 104: it should read:
>                                 if (con->typename != NULL)
> !                                       result = parser_typecast(val,
> con->typename, -1);
>                                 else
>
> I think all funcs calling with atttypmod = 0 are allways wrong, should
> be -1.
> or a number > 0 (or 4 if atttypmod includes the VARHDRSZ don't know)
>
> Andreas
>
>

Yes, we did, but now I fixed varcharin, and bpcharin to test for
atttypmod of 0 and do the right thing, I think.  If we need to make the
default atttypmod value -1, then we can change it back.  Let me know if
the current fix does not work.

Should I make atttypmod default to -1?

--
Bruce Momjian
maillist@candle.pha.pa.us

pgsql-hackers by date:

Previous
From: Bruce Momjian
Date:
Subject: atttypmod is wrong in system catalogs
Next
From: Bruce Momjian
Date:
Subject: atttypmod problem