Thread

  1. Re: creating CHECK constraints as NOT VALID

    Alvaro Herrera <alvherre@commandprompt.com> — 2011-06-15T20:51:11Z

    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