add column .. default

Поиск
Список
Период
Сортировка
От Rod Taylor
Тема add column .. default
Дата
Msg-id 1055988581.23385.48.camel@jester
обсуждение исходный текст
Ответы Re: add column .. default  (Tom Lane <tgl@sss.pgh.pa.us>)
Список 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@rbt.ca>

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

В списке pgsql-hackers по дате отправления:

Предыдущее
От: "Matthew T. O'Connor"
Дата:
Сообщение: Re: Two weeks to feature freeze
Следующее
От: Alvaro Herrera
Дата:
Сообщение: Re: Two weeks to feature freeze