Re: [HACKERS] Lazy constraints / defaults

2008-05-07 Thread Bruce Momjian
I am wondering whether people use ALTER TABLE ALTER COLUMN foo SET NOT NULL enough to justify concurrency coding. --- Decibel! wrote: > This would be very useful for me, and would satisfy the OP's request. > > Can we get a

Re: [HACKERS] Lazy constraints / defaults

2008-03-20 Thread Decibel!
This would be very useful for me, and would satisfy the OP's request. Can we get a TODO? On Mar 9, 2008, at 4:45 PM, Dawid Kuroczko wrote: On Sun, Mar 9, 2008 at 7:25 PM, Tom Lane <[EMAIL PROTECTED]> wrote: "=?ISO-8859-2?Q?Micha=B3_Zaborowski?=" <[EMAIL PROTECTED]> writes: I would like to

Re: [HACKERS] Lazy constraints / defaults

2008-03-20 Thread Dawid Kuroczko
On Thu, Mar 20, 2008 at 4:56 PM, Decibel! <[EMAIL PROTECTED]> wrote: > This would be very useful for me, and would satisfy the OP's request. > > Can we get a TODO? If you feel adventureous you may UPDATE catalog constrains directly, which will work more or less as "enforce, don't validate, don't

Re: [HACKERS] Lazy constraints / defaults

2008-03-10 Thread Michał Zaborowski
Hello, Let me try again... Here is simple example. To do: alter table users add column integer not null default 0; Table is big, updated, referenced etc (big - means that alter lock the table long enought to kill the system). Note that it is not my design - I have to do alter the table... b

Re: [HACKERS] Lazy constraints / defaults

2008-03-10 Thread Martijn van Oosterhout
On Sun, Mar 09, 2008 at 10:45:59PM +0100, Dawid Kuroczko wrote: > > alter table tab add column col integer not null default 42 check (col > 0); > > I think this will not solve the OP's problem. He wants to minimize the time > a table is under exclusive lock, and this ALTER command will effective

Re: [HACKERS] Lazy constraints / defaults

2008-03-09 Thread Dawid Kuroczko
On Sun, Mar 9, 2008 at 7:25 PM, Tom Lane <[EMAIL PROTECTED]> wrote: > "=?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

Re: [HACKERS] Lazy constraints / defaults

2008-03-09 Thread Tom Lane
"=?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 a

[HACKERS] Lazy constraints / defaults

2008-03-09 Thread Michał Zaborowski
Hello, I would like to be able to add CONSTRAINT and/or DEFAULT with out affecting old rows. 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 DEFAU