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.

David Fetter <da...@fetter.org> http://fetter.org/
Phone: +1 415 235 3778  AIM: dfetter666  Yahoo!: dfetter
Skype: davidfetter      XMPP: david.fet...@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

Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:

Reply via email to