Re: CHECK NO INHERIT syntax - Mailing list pgsql-hackers

From Alvaro Herrera
Subject Re: CHECK NO INHERIT syntax
Date
Msg-id 1342814413-sup-2460@alvh.no-ip.org
Whole thread Raw
In response to CHECK NO INHERIT syntax  (Peter Eisentraut <peter_e@gmx.net>)
Responses Re: CHECK NO INHERIT syntax
List pgsql-hackers
Excerpts from Peter Eisentraut's message of mié jul 18 17:49:37 -0400 2012:
> Sorry to raise this once again, but I still find this CHECK NO INHERIT
> syntax to a bit funny.  We are currently using something like
>
> CHECK NO INHERIT (foo > 0)
>
> But we already have a different syntax for attaching attributes to
> constraints (NOT DEFERRABLE, NOT VALID,  etc.), so it would make more
> sense to have
>
> CHECK (foo > 0) NO INHERIT

Okay, given the astounding acceptance of your proposal, the attached patch
fixes things in that way.  This only include changes to the core code;
I'll prepare documentation and regression tests tweaks while I wait for an
answer to the request below.

> There is also a hole in the current implementation.  Domain constraints
> silently allow NO INHERIT to be specified, even though other senseless
> attributes are rejected.

True.  I have added an error check at creation time.  Please suggest
improved wording for the message:

alvherre=# create domain positiveint2 as int check (value > 0) no inherit;
ERROR:  CHECK constraints for domains cannot be NO INHERIT

--
Álvaro Herrera <alvherre@commandprompt.com>
The PostgreSQL Company - Command Prompt, Inc.
PostgreSQL Replication, Consulting, Custom Development, 24x7 support

Attachment

pgsql-hackers by date:

Previous
From: Robert Haas
Date:
Subject: Re: Event Triggers reduced, v1
Next
From: Tom Lane
Date:
Subject: Re: CHECK NO INHERIT syntax