From: | Mathieu Arnold <mat(at)mat(dot)cc> |
---|---|
To: | "Hillensbeck, Preston" <PHillensbeck(at)sfbcic(dot)com> |
Cc: | "'pgsql-general(at)postgresql(dot)org'" <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: delete column |
Date: | 2002-04-27 10:10:11 |
Message-ID: | 10439662.1019909411@tot.in.t-online.fr |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
--On vendredi 26 avril 2002 15:49 -0500 "Hillensbeck, Preston"
<PHillensbeck(at)sfbcic(dot)com> wrote:
> There isn't a DROP COLUMN function yet, but you can do this...
>
> SELECT ... -- select all columns but the one you want to remove
> INTO TABLE new_table
> FROM old_table;
> DROP TABLE old_table;
> ALTER TABLE new_table RENAME TO old_table;
>
> This is straight out of Bruce Momjian's book, so you can give him credit
> for this :)
this is not really good, as you loose all defaults from the table.
I believe that
CREATE TABLE new_table (fields without the one you want);
INSERT INTO new_table SELECT ... FROM old_table;
DROP TABLE old_table;
ALTER TABLE new_table RENAME to old_table;
--
Mathieu Arnold
From | Date | Subject | |
---|---|---|---|
Next Message | Francois Suter | 2002-04-27 10:26:09 | Re: pid gets overwritten in OSX |
Previous Message | Lincoln Yeoh | 2002-04-27 10:06:41 | Re: intel vs amd benchmark for pg server part 2 |