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

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

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Nikhil Sontakke <nikkhils(at)gmail(dot)com>
Cc: Jim Nasby <jim(at)nasby(dot)net>, Alvaro Herrera <alvherre(at)commandprompt(dot)com>, Peter Eisentraut <peter_e(at)gmx(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-01-18 23:17:59
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-hackers
On Wed, Jan 18, 2012 at 12:10 AM, Nikhil Sontakke <nikkhils(at)gmail(dot)com> wrote:
>> >> It appears that the only way to create a non-inherited CHECK constraint
>> >> is using ALTER TABLE.  Is there no support in CREATE TABLE planned?
>> >> That looks a bit odd.
>> >
>> > There are no plans to do that AFAIR, though maybe you could convince
>> > Nikhil to write the patch to do so.
>> That certainly doesn't meet the principle of least surprise... CREATE
>> TABLE should support this.
> Well, the above was thought about during the original discussion and
> eventually we felt that CREATE TABLE already has other issues as well, so
> not having this done as part of creating a table was considered acceptable
> then:
> But, let me have a stab at it when I get some free cycles.

I agree with Peter that we should have we should have CHECK ONLY.
ONLY is really a property of the constraint, not the ALTER TABLE
command -- if it were otherwise, we wouldn't need to store it the
system catalogs, but of course we do.  The fact that it's not a
standard property isn't a reason not to have proper syntax for it.

Robert Haas
The Enterprise PostgreSQL Company

In response to


pgsql-hackers by date

Next:From: Gražvydas ValeikaDate: 2012-01-18 23:25:02
Subject: Strange primary key constraint influence to grouping
Previous:From: Robert HaasDate: 2012-01-18 23:12:40
Subject: Re: Should I implement DROP INDEX CONCURRENTLY?

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