Re: CHECK NO INHERIT syntax
Alvaro Herrera <alvherre@commandprompt.com>
From: Alvaro Herrera <alvherre@commandprompt.com>
To: Peter Eisentraut <peter_e@gmx.net>
Cc: Pg Hackers <pgsql-hackers@postgresql.org>
Date: 2012-07-20T20:07:13Z
Lists: pgsql-hackers
Attachments
- check-no-inherit.patch (application/octet-stream) patch
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