Re: Adding time to DATE type - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Adding time to DATE type
Date
Msg-id 1512.960829800@sss.pgh.pa.us
Whole thread Raw
In response to Re: Adding time to DATE type  (Peter Eisentraut <peter_e@gmx.net>)
Responses Re: Adding time to DATE type  (Peter Eisentraut <e99re41@DoCS.UU.SE>)
Re: Adding time to DATE type  (Bruce Momjian <pgman@candle.pha.pa.us>)
List pgsql-hackers
Peter Eisentraut <peter_e@gmx.net> writes:
> Bruce Momjian writes:
>> Can someone give me a TODO summary for this issue?

> * make 'text' constants default to text type (not unknown)

> (I think not everyone's completely convinced on this issue, but I don't
> recall anyone being firmly opposed to it.)

It would be a mistake to eliminate the distinction between unknown and
text.  See for example my just-posted response to John Cochran on
pgsql-general about why 'BOULEVARD'::text behaves differently from
'BOULEVARD'::char.  If string literals are immediately assigned type
text then we will have serious problems with char(n) fields.

I think it's fine to assign string literals a type of 'unknown'
initially.  What we need to do is add a phase of type resolution that
considers treating them as text, but only after the existing logic fails
to deduce a type.

(BTW it might be better to treat string literals as defaulting to char(n)
instead of text, allowing the normal promotion rules to replace char(n)
with text if necessary.  Not sure if that would make things more or less
confusing for operations that intermix fixed- and variable-width char
types.)
        regards, tom lane


pgsql-hackers by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: [COMMITTERS] pgsql (Makefile)
Next
From: The Hermit Hacker
Date:
Subject: Re: ALTER TABLE DROP COLUMN