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

From Neil Conway
Subject Re: [BUGS] BUG #1290: Default value and ALTER...TYPE
Date
Msg-id 417B849D.1030703@samurai.com
Whole thread Raw
In response to Re: [BUGS] BUG #1290: Default value and ALTER...TYPE  (Tom Lane <tgl@sss.pgh.pa.us>)
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  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
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? That would 
mean we can just reuse the cooked parsetree (w/o the coercion) and add a 
coercion to the correct column type @ ALTER TABLE time.

-Neil


pgsql-hackers by date:

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