From: | Andrew Sullivan <andrew(at)libertyrms(dot)info> |
---|---|
To: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: Evolving databases (eg deleting columns) |
Date: | 2002-07-26 14:22:28 |
Message-ID: | 20020726102228.B18001@mail.libertyrms.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On Thu, Jul 25, 2002 at 05:19:18PM -0700, Christian H. Stork wrote:
> My question: How can I evolve databases (ie deleting columns,
> adding/changing/removing constraints, etc)?
You can use ALTER TABLE for adding & removing constraints. But you
can't delete columns.
You can leave the columns in, however. You can add a new column,
renaming the former column to something new (like colname_dead), and
name the new column to the name of the original column. Then do
UPDATE table SET colname=colname_dead;
UPDATE table SET colname_dead=NULL;
Then, make that column null always. There's very little overhead
attached to a column with all nulls (4 bytes? I think that's it.
There's a map that needs to be maintained, but that's it).
A
--
----
Andrew Sullivan 87 Mowat Avenue
Liberty RMS Toronto, Ontario Canada
<andrew(at)libertyrms(dot)info> M6K 3E3
+1 416 646 3304 x110
From | Date | Subject | |
---|---|---|---|
Next Message | Justin Clift | 2002-07-26 14:25:07 | Re: Bad HTML in Mail List Archives |
Previous Message | Ribamar FS | 2002-07-26 14:15:55 | Re: RES: [JDBC] Java access pgsql sample : Solution!!! |