
* Henry Combrinck
You don't have a nice little alter...table(s) script you can paste herein, do you? ;-)
I think Robert Mathews' snippet should work, but I havent tested it myself. If I generalize his code a bit, to change column "bar" in table "foo" to int4, something like this would be required: BEGIN; LOCK TABLE foo; ALTER TABLE foo ADD COLUMN new_col int; UPDATE foo SET new_col = bar; ALTER TABLE foo DROP COLUMN bar; ALTER TABLE foo RENAME COLUMN new_col TO bar; ALTER TABLE foo ADD PRIMARY KEY (bar); ALTER TABLE foo ALTER COLUMN bar SET DEFAULT nextval('"foo_bar_seq"'::text); COMMIT; ANALYZE; The exact contents of nextval(...) should probably be copied from "\d foo" beforehand. Keep your backups handy, and if you have the luxury to do so, try it on your test systems first... Arne.