Re: creating CHECK constraints as NOT VALID

From: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
To: Jaime Casanova <jaime(at)2ndquadrant(dot)com>
Cc: Dean Rasheed <dean(dot)a(dot)rasheed(at)gmail(dot)com>, Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: creating CHECK constraints as NOT VALID
Date: 2011-06-15 20:51:11
Message-ID: 1308171012-sup-4753@alvh.no-ip.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Excerpts from Jaime Casanova's message of mié jun 15 02:09:15 -0400 2011:

> psql \h says (among other things) for ALTER TABLE
> """
> ADD table_constraint
> ADD table_constraint_using_index
> ADD table_constraint [ NOT VALID ]
> """
>
> ADD table_constraint appears twice and isn't true that all
> table_constraint accept the NOT VALID syntax... maybe we can accpet
> the syntax and send an unimplemented feature message for the other
> table_constraints?
>
> attached, is a script with the examples i have tried:
>
> EXAMPLE 1:
> constraint_exclusion when using NOT VALID check constraints... and it
> works well, except when the constraint has been validated, it keeps
> ignoring it (which means i won't benefit from constraint_exclusion)
> until i execute ANALYZE on the table or close connection

Here's an updated patch fixing all of the above. I stole your first
test case and added it to regression, after some editorialization.

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

Attachment Content-Type Size
not-valid-check-4.patch application/octet-stream 51.1 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Alvaro Herrera 2011-06-15 20:59:09 Re: FK NOT VALID can't be deferrable?
Previous Message Peter Eisentraut 2011-06-15 20:44:34 Re: Why polecat and colugos are failing to build back branches