Re: ALTER TABLE modifications

From: Peter Eisentraut <peter_e(at)gmx(dot)net>
To: Rod Taylor <pg(at)rbt(dot)ca>
Cc: PostgreSQL Patches <pgsql-patches(at)postgresql(dot)org>
Subject: Re: ALTER TABLE modifications
Date: 2003-11-13 14:18:30
Message-ID: Pine.LNX.4.44.0311131514220.16787-100000@peter.localdomain
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-patches

Rod Taylor writes:

> Yes, it is certainly fine to do so, but much faster to do the above.

Are table schema changes performance-sensitive operations, and are they
usually done in bulk? I doubt it.

> I've not found another database which allows this syntax. The suggestion
> of TRANSFORM was Toms and was a result of using an assignment cast by
> default. Do you have a better term I can use?

I'm not sure I buy this whole concept in the first place. If there is
no cast between type A and type B, then surely changing a table column
from A to B is nonsensical.

> -- or say Bytes to MBytes (original column is int8)
> ALTER TABLE tab ALTER col TYPE integer TRANSFORM col / (1024 * 1024);

You can do this using a plain column type change plus an UPDATE. I'd
prefer to keep these operations independent.

--
Peter Eisentraut peter_e(at)gmx(dot)net

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Eisentraut 2003-11-13 14:20:05 Re: ALTER TABLE modifications
Previous Message Andrew Dunstan 2003-11-13 13:14:27 Re: [PATCHES] initdb in C

Browse pgsql-patches by date

  From Date Subject
Next Message Peter Eisentraut 2003-11-13 14:20:05 Re: ALTER TABLE modifications
Previous Message Andrew Dunstan 2003-11-13 13:14:27 Re: [PATCHES] initdb in C