Skip site navigation (1) Skip section navigation (2)

Re: CHECK NO INHERIT syntax

From: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Peter Eisentraut <peter_e(at)gmx(dot)net>, Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: CHECK NO INHERIT syntax
Date: 2012-07-21 04:20:57
Message-ID: 1342844177-sup-4470@alvh.no-ip.org (view raw or flat)
Thread:
Lists: pgsql-hackers
Excerpts from Tom Lane's message of vie jul 20 16:12:05 -0400 2012:
> 
> Alvaro Herrera <alvherre(at)commandprompt(dot)com> writes:
> > 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
> 
> I think "CHECK constraints for domains cannot be marked NO INHERIT"
> would be fine.

Thanks.

> >  ConstraintElem:
> > -            CHECK opt_no_inherit '(' a_expr ')' ConstraintAttributeSpec
> > +            CHECK '(' a_expr ')' opt_no_inherit ConstraintAttributeSpec
> 
> This doesn't seem to me to meet the principle of least surprise.  Surely
> NO INHERIT ought to be folded into ConstraintAttributeSpec so that it
> acts like other constraint decorations, ie order isn't significant.

Oh, true; that's a bit more involved.  I verified it works correctly to
have a constraint marked NOT VALID NO INHERIT or the other way around.
I haven't checked whether the changes to ConstraintAttributeSpec have
side effects -- I think it's OK but I might be missing something.

Here's a (hopefully) complete patch.

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

Attachment: check-no-inherit-2.patch
Description: application/octet-stream (25.2 KB)

In response to

Responses

pgsql-hackers by date

Next:From: Adam CrewsDate: 2012-07-21 05:24:11
Subject: postgres 9 bind address for replication
Previous:From: Chris AngelicoDate: 2012-07-21 01:57:43
Subject: Re: Pg_ctl promote -- wait for slave to be promoted fully ?

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group