"=?ISO-8859-2?Q?Micha=B3_Zaborowski?=" <[EMAIL PROTECTED]> writes:
>  I would like to be able to add CONSTRAINT and/or DEFAULT with out
> affecting old rows.

You mean without actually checking that the old rows satisfy the
constraint?  There's approximately zero chance that that proposal
will be accepted.

> Yes, it sounds strange, but... Let's say I have
> big table, I want to add new column, with DEFAULT and NOT NULL.
> Normally it means long exclusive lock. So - right now I'm adding plain
> new column, then DEFAULT, then UPDATE on all rows in chunks, then NOT
> NULL... Can it be little simpler?

Just do it all in one ALTER command.

alter table tab add column col integer not null default 42 check (col > 0);

                        regards, tom lane

-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Reply via email to