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

From David Fetter
Subject Re: CHECK NO INHERIT syntax
Date
Msg-id 20120719223049.GA1981@fetter.org
Whole thread Raw
In response to CHECK NO INHERIT syntax  (Peter Eisentraut <peter_e@gmx.net>)
Responses Re: CHECK NO INHERIT syntax  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
On Thu, Jul 19, 2012 at 12:49:37AM +0300, Peter Eisentraut wrote:
> 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

How about this?
   CHECK (foo > 0) (INHERIT FALSE)   
That leaves an obvious place for other options, which will doubtless
come.  EXPLAIN's options inspired this API design.

> Besides consistency, this makes more sense, because the attribute is a
> property of the constraint as a whole, not of the "checking".

Good point.  The above change preserves this property.

> This would also extend more easily to other constraint types.  For
> example, when unifying CHECK and NOT NULL constraints, as is
> planned, or when allowing inherited unique constraints, as is
> planned further down the road.
> 
> 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.

That's probably a bug.

Cheers,
David.
-- 
David Fetter <david@fetter.org> http://fetter.org/
Phone: +1 415 235 3778  AIM: dfetter666  Yahoo!: dfetter
Skype: davidfetter      XMPP: david.fetter@gmail.com
iCal: webcal://www.tripit.com/feed/ical/people/david74/tripit.ics

Remember to vote!
Consider donating to Postgres: http://www.postgresql.org/about/donate


pgsql-hackers by date:

Previous
From: Samuel Vogel
Date:
Subject: Re: b-tree index search algorithms
Next
From: Tom Lane
Date:
Subject: Re: b-tree index search algorithms