Re: [HACKERS] BUG #1290: Default value and ALTER...TYPE

From: Neil Conway <neilc(at)samurai(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Troels Arvin <troels(at)arvin(dot)dk>, pgsql-bugs(at)postgresql(dot)org, pgsql-hackers(at)postgresql(dot)org
Subject: Re: [HACKERS] BUG #1290: Default value and ALTER...TYPE
Date: 2004-10-24 10:31:57
Message-ID: 417B849D.1030703@samurai.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs 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

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Magnus Hagander 2004-10-24 10:43:13 Re: Beta3 much slower than Beta2
Previous Message Harald Armin Massa 2004-10-24 10:19:31 Re: Question on the 8.0Beta Version

Browse pgsql-hackers by date

  From Date Subject
Next Message Dennis Bjorklund 2004-10-24 11:11:15 Re: [HACKERS] BUG #1290: Default value and ALTER...TYPE
Previous Message Harald Armin Massa 2004-10-24 10:19:31 Re: Question on the 8.0Beta Version