Re: creating CHECK constraints as NOT VALID

From: Thom Brown <thom(at)linux(dot)com>
To: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
Cc: Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: creating CHECK constraints as NOT VALID
Date: 2011-06-01 00:18:18
Message-ID: BANLkTiktuHwN11qgyERfz29gF3aMUuAUCA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 31 May 2011 18:43, Alvaro Herrera <alvherre(at)commandprompt(dot)com> wrote:
>
> Here it is -- as a context patch this time, as well.
>
> --
> Álvaro Herrera <alvherre(at)commandprompt(dot)com>
> The PostgreSQL Company - Command Prompt, Inc.
> PostgreSQL Replication, Consulting, Custom Development, 24x7 support

There is this scenario:

test=# CREATE DOMAIN things AS INT CHECK (VALUE > 5);
CREATE DOMAIN
test=# CREATE TABLE abc (id SERIAL, stuff things);
NOTICE: CREATE TABLE will create implicit sequence "abc_id_seq" for
serial column "abc.id"
CREATE TABLE
test=# INSERT INTO abc (stuff) VALUES (55);
INSERT 0 1
test=# ALTER DOMAIN things ADD CONSTRAINT meow CHECK (VALUE < 11) NOT VALID;
ERROR: column "stuff" of table "abc" contains values that violate the
new constraint
STATEMENT: ALTER DOMAIN things ADD CONSTRAINT meow CHECK (VALUE < 11)
NOT VALID;

--
Thom Brown
Twitter: @darkixion
IRC (freenode): dark_ixion
Registered Linux user: #516935

EnterpriseDB UK: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Mark Kirkwood 2011-06-01 00:27:46 Re: patch review : Add ability to constrain backend temporary file space
Previous Message Tatsuo Ishii 2011-06-01 00:08:47 Any idea for serializing INSERTING SERIAL column?