Re: [BUGS] BUG #1290: Default value and ALTER...TYPE - Mailing list pgsql-hackers

From Tom Lane
Subject Re: [BUGS] BUG #1290: Default value and ALTER...TYPE
Date
Msg-id 8379.1098628209@sss.pgh.pa.us
Whole thread Raw
In response to Re: [BUGS] BUG #1290: Default value and ALTER...TYPE  (Neil Conway <neilc@samurai.com>)
Responses Re: [BUGS] BUG #1290: Default value and ALTER...TYPE  (Dennis Bjorklund <db@zigo.dhs.org>)
Re: [BUGS] BUG #1290: Default value and ALTER...TYPE  (Neil Conway <neilc@samurai.com>)
List pgsql-hackers
Neil Conway <neilc@samurai.com> writes:
> Tom Lane wrote:
>> Possibly we should make ALTER COLUMN strip any implicit coercions that
>> appear at the top level of the default expression before it adds on the
>> implicit coercion to the new column datatype.

> That seems like a kludge. When processing a column default expression, we:

> (1) Accept the default's raw parsetree from the parser
> (2) Convert it to a cooked parsetree via transformExpr()
> (3) Add a coercion to the table's column type

> Can't we save the cooked parsetree that we produced in #2?

Not without an initdb (to have another column to put it in).  And it
would produce exactly the same result anyway, because the only way there
could be implicit coercion steps at the top of the expression is because
step 3 put them there.
        regards, tom lane


pgsql-hackers by date:

Previous
From: Dennis Bjorklund
Date:
Subject: Re: [BUGS] BUG #1290: Default value and ALTER...TYPE
Next
From: Tom Lane
Date:
Subject: Re: Daylight saving time