From: | Rod Taylor <pg(at)rbt(dot)ca> |
---|---|
To: | pg(at)fastcrypt(dot)com |
Cc: | Peter Eisentraut <peter_e(at)gmx(dot)net>, Hannu Krosing <hannu(at)tm(dot)ee>, PostgreSQL Patches <pgsql-patches(at)postgresql(dot)org> |
Subject: | Re: ALTER TABLE modifications |
Date: | 2003-11-14 16:44:08 |
Message-ID: | 1068828247.35839.80.camel@jester |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers pgsql-patches |
> lock table
> create newtable as select c1, c2, c3::newtype
> modify pg_class to point to the new filename
> modify existing pg_attribute for the column in question
> recreate indexes that exist on the column
> unlock table
I actually tried this to start with an ran into several dead-ends in
trying to rebuild constraints, defaults, etc. In order to do this I
think you would need to create a second pg_class entry and do a full
table swap.
By far, the easiest method to preserve order without writing a ton of
additional code is to do something that is on the TODO list already,
separate the visible position from physical position.
Doing the above has lots of added benefits, where spending a ton of time
on TYPE change has very few benefits.
From | Date | Subject | |
---|---|---|---|
Next Message | jacek | 2003-11-14 16:48:53 | Re: Problem with compilation 7.3.4 |
Previous Message | Tom Lane | 2003-11-14 16:43:38 | Re: heads up -- subtle change of behavior of new initdb |
From | Date | Subject | |
---|---|---|---|
Next Message | Peter Eisentraut | 2003-11-14 16:51:44 | Re: ALTER TABLE modifications |
Previous Message | Tom Lane | 2003-11-14 16:43:38 | Re: heads up -- subtle change of behavior of new initdb |