Re: Review: Non-inheritable check constraints - Mailing list pgsql-hackers

From Robert Haas
Subject Re: Review: Non-inheritable check constraints
Date
Msg-id CA+TgmobYkJscHA9UO6+fQKh=e_v9=9Yj-pzR9n9DSiFVevo-vg@mail.gmail.com
Whole thread Raw
In response to Re: Review: Non-inheritable check constraints  (Alvaro Herrera <alvherre@commandprompt.com>)
Responses Re: Review: Non-inheritable check constraints
List pgsql-hackers
On Thu, Dec 22, 2011 at 10:54 PM, Alvaro Herrera
<alvherre@commandprompt.com> wrote:
> I agree with Robert that this usage of ALTER TABLE ONLY is slightly
> different from other usages of the same command, but I disagree that
> this means that we need another command to do what we want to do here.
> IOW, I prefer to keep the syntax we have.

Another disadvantage of the current syntax becomes evident when you
look at the pg_dump output.  If you pg_dump a regular constraint, the
constraint gets added as part of the table definition, and the rows
are all checked as they are inserted.  If you pg_dump an ONLY
constraint, the constraint gets added after loading the data,
requiring an additional full-table scan to validate it.

>> > I am tempted to say we should revert this and rethink.  I don't
>> > believe we are only a small patch away from finding all the bugs here.
>>
>> Sure, if we all think that CREATE TABLE should support ONLY CONSTRAINT type
>> of syntax, then +1 for reverting this and a subsequent revised submission.
>
> I don't think this is a given ...  In fact, IMO if we're only two or
> three fixes away from having it all nice and consistent, I think
> reverting is not necessary.

Sure.  It's the "if" part of that sentence that I'm not too sure about.

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company


pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: xlog location arithmetic
Next
From: Robert Haas
Date:
Subject: Re: xlog location arithmetic