AW: [HACKERS] Re: atttypmod of 0

From: Zeugswetter Andreas DBT <Andreas(dot)Zeugswetter(at)telecom(dot)at>
To: "'Bruce Momjian'" <maillist(at)candle(dot)pha(dot)pa(dot)us>
Cc: "'pgsql-hackers(at)hub(dot)org'" <pgsql-hackers(at)hub(dot)org>
Subject: AW: [HACKERS] Re: atttypmod of 0
Date: 1998-02-06 07:52:17
Message-ID: 219F68D65015D011A8E000006F8590C6010A51BC@sdexcsrv1.sd.spardat.at
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Yes, I think to change atttypmod to default to -1 would be the right
thing,
since the empty string '' really has a length of 0,
We could think of -1 as: We don't know how long this field will be.
0 would mean the field has 0 bytes.

Andreas

> >
> > 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(at)candle(dot)pha(dot)pa(dot)us
>
>

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Meskes 1998-02-06 08:42:57 Re: [HACKERS] Preprocessor
Previous Message Vadim B. Mikheev 1998-02-06 07:48:58 Re: [HACKERS] what standard say ...