Re: how to create a non-inherited CHECK constraint in CREATE TABLE

From: Noah Misch <noah(at)leadboat(dot)com>
To: Nikhil Sontakke <nikkhils(at)gmail(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Robert Haas <robertmhaas(at)gmail(dot)com>, Alvaro Herrera <alvherre(at)commandprompt(dot)com>, Peter Eisentraut <peter_e(at)gmx(dot)net>, Jim Nasby <jim(at)nasby(dot)net>, Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: how to create a non-inherited CHECK constraint in CREATE TABLE
Date: 2012-04-15 20:15:35
Message-ID: 20120415201535.GA22182@tornado.leadboat.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, Apr 12, 2012 at 10:50:31AM +0530, Nikhil Sontakke wrote:
> > > CHECK NO INHERIT sounds fine to me; will that display ALTER TABLE ONLY
> > > x as the one true way of doing this?
> >
> > s/display/displace/, I think you meant? Yeah, that's what I understand
> > the proposal to be.

+1 for that proposal.

> Displace yes. It would error out if someone says
>
> ALTER TABLE ONLY... CHECK ();
>
> suggesting to use the ONLY with the CHECK.

I'd say the behavior for that case can revert to the PostgreSQL 9.1 behavior.
If the table has children, raise an error. Otherwise, add an inheritable
CHECK constraint, albeit one lacking inheritors at that moment.

Thanks,
nm

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Greg Smith 2012-04-15 22:11:48 Re: Last gasp
Previous Message Simon Riggs 2012-04-15 19:13:23 Re: Last gasp