Re: [COMMITTERS] pgsql: Enable CHECK constraints to be declared NOT VALID

From: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
To: Dean Rasheed <dean(dot)a(dot)rasheed(at)gmail(dot)com>
Cc: Thom Brown <thom(at)linux(dot)com>, Robert Haas <robertmhaas(at)gmail(dot)com>, Jim Nasby <jim(at)nasby(dot)net>, Joshua D(dot) Drake <jd(at)commandprompt(dot)com>, Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: [COMMITTERS] pgsql: Enable CHECK constraints to be declared NOT VALID
Date: 2011-11-25 21:28:20
Message-ID: 1322256419-sup-7794@alvh.no-ip.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers pgsql-hackers


Excerpts from Dean Rasheed's message of vie nov 25 13:45:34 -0300 2011:

> Looking back at Thom's original example, it seems odd to allow this
> syntax at all:
>
> CREATE TABLE a (
> num integer,
> CONSTRAINT meow CHECK ((num < 20)) NOT VALID
> );
>
> It's not documented, but is currently allowed. However, since all data
> subsequently added to the table is checked against the constraint, the
> constraint is guaranteed to be valid, so there seems to be no point in
> allowing it to be declared NOT VALID.

Hah ... interesting. Not sure it's worth fussing about this. If the
user shoots himself in the foot by declaring an unvalidated constraint,
which is not even documented, are we really at fault?

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

In response to

Responses

Browse pgsql-committers by date

  From Date Subject
Next Message Bruce Momjian 2011-11-26 00:08:43 pgsql: Remove ENABLE_SAME_CATVERSION_UPGRADES as unnecessary.
Previous Message Alvaro Herrera 2011-11-25 21:24:50 Re: [COMMITTERS] pgsql: Enable CHECK constraints to be declared NOT VALID

Browse pgsql-hackers by date

  From Date Subject
Next Message Jeff Janes 2011-11-25 21:32:15 Re: Inserting heap tuples in bulk in COPY
Previous Message Alvaro Herrera 2011-11-25 21:24:50 Re: [COMMITTERS] pgsql: Enable CHECK constraints to be declared NOT VALID