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

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

Neil Conway <neilc(at)samurai(dot)com> writes:
> On Mon, 2004-10-25 at 00:30, Tom Lane wrote:
>> 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.

> Per your earlier comment: "I am not sure that this is a good idea,
> however; it seems like it might alter the semantics in
> unexpected ways. (The default expression could potentially come through
> differently than an actually stored value of the column would do.)"

> So you can't have it both ways :)

Sure I can. The method you propose will produce exactly the same
results as what's in there. I am still a bit concerned about
nonintuitive results in some cases, but changing it like this wouldn't
fix that; it's just a different way of getting to the same place.

The bottom line here is what will produce the least surprise in the most
cases. The case that actually convinced me to do it was thinking about
serial columns. As it is now, "ALTER COLUMN TYPE bigint" will
successfully convert a serial to a bigserial; before, it wouldn't,
because the result of nextval() would still get squeezed down to int4.

regards, tom lane

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message PostgreSQL Bugs List 2004-10-25 01:22:37 BUG #1292: ecpg precompile bug (valiable typedef & define )
Previous Message Neil Conway 2004-10-24 23:41:37 Re: [HACKERS] BUG #1290: Default value and ALTER...TYPE

Browse pgsql-hackers by date

  From Date Subject
Next Message Andrew Dunstan 2004-10-24 23:56:54 windows milestone
Previous Message Neil Conway 2004-10-24 23:41:37 Re: [HACKERS] BUG #1290: Default value and ALTER...TYPE