Re: how to create a non-inherited CHECK constraint in CREATE TABLE

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
Cc: Andrew Dunstan <andrew(at)dunslane(dot)net>, Nikhil Sontakke <nikkhils(at)gmail(dot)com>, Peter Eisentraut <peter_e(at)gmx(dot)net>, Robert Haas <robertmhaas(at)gmail(dot)com>, Jim Nasby <jim(at)nasby(dot)net>, Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: how to create a non-inherited CHECK constraint in CREATE TABLE
Date: 2012-04-11 19:06:17
Message-ID: 29132.1334171177@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Alvaro Herrera <alvherre(at)commandprompt(dot)com> writes:
> Excerpts from Andrew Dunstan's message of mi abr 11 15:51:51 -0300 2012:
>> On 04/11/2012 02:45 PM, Tom Lane wrote:
>>> I don't really care for the idea that the ONLY goes in a different place
>>> for this operation than for every other kind of ALTER TABLE, but it does
>>> make sense if you subscribe to the quoted theory that ONLY is a property
>>> of the constraint and not the ALTER command as such.

>> I think I rather dislike it. ONLY should be followed by the name of the
>> parent table whose children it causes us to exclude, IMNSHO. Moving it
>> elsewhere doesn't seem to me to be a blow for clarity at all.

> If that's the only objection, maybe we could use a different keyword
> then, perhaps NOINHERIT:

> ALTER TABLE constraint_rename_test ADD CONSTRAINT con2 CHECK NOINHERIT (b> 0);

I could live with that. "CHECK ONLY" isn't particularly transparent as
to what it means, anyway. "CHECK NOINHERIT" seems a lot clearer.

I'd propose "CHECK NO INHERIT", though, as (a) it seems better English
and (b) it avoids creating any new keyword.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Nolan 2012-04-11 19:09:53 Fwd: [HACKERS] [streaming replication] 9.1.3 streaming replication bug ?
Previous Message Alvaro Herrera 2012-04-11 18:58:36 Re: how to create a non-inherited CHECK constraint in CREATE TABLE