Re: creating CHECK constraints as NOT VALID - Mailing list pgsql-hackers

From Alvaro Herrera
Subject Re: creating CHECK constraints as NOT VALID
Date
Msg-id 1308171012-sup-4753@alvh.no-ip.org
Whole thread Raw
In response to Re: creating CHECK constraints as NOT VALID  (Jaime Casanova <jaime@2ndquadrant.com>)
Responses Re: creating CHECK constraints as NOT VALID
List 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@commandprompt.com>
The PostgreSQL Company - Command Prompt, Inc.
PostgreSQL Replication, Consulting, Custom Development, 24x7 support

Attachment

pgsql-hackers by date:

Previous
From: Peter Eisentraut
Date:
Subject: Re: Why polecat and colugos are failing to build back branches
Next
From: Alvaro Herrera
Date:
Subject: Re: FK NOT VALID can't be deferrable?