add column .. default

From: Rod Taylor <rbt(at)rbt(dot)ca>
To: PostgreSQL Development <pgsql-hackers(at)postgresql(dot)org>
Subject: add column .. default
Date: 2003-06-19 02:09:42
Message-ID: 1055988581.23385.48.camel@jester
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

I took a quick glance at this.

It boils down to essentially an:

1) ALTER TABLE .. ADD COLUMN <column> DEFAULT <default> <constraints>
2) UPDATE .. SET <column> = <default> IF <default> IS NOT NULL;
3) Add <constraints> including NOT NULL, CHECK, Foreign Key, etc. each
of which will do it's own confirmation pass on the values inserted into
the table by step 2 for the table for the new column.

If all additional constraints are added after the values are in the
table (via standard ALTER TABLE functions), is there anything the update
(step 2) needs to check aside from Domain constraints (coerce <default>
to datatype of <column>)?

For the update I intend to use double space, as if the user did those
items as individual commands within the same transaction. Someone can
make it more efficient in regards to constraint checks, etc. in the
future if they want -- I don't intend to.

--
Rod Taylor <rbt(at)rbt(dot)ca>

PGP Key: http://www.rbt.ca/rbtpub.asc

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Alvaro Herrera 2003-06-19 02:30:14 Re: Two weeks to feature freeze
Previous Message Matthew T. O'Connor 2003-06-19 01:59:17 Re: Two weeks to feature freeze