Re: creating CHECK constraints as NOT VALID

Marko Tiikkaja <marko.tiikkaja@2ndquadrant.com>

From: Marko Tiikkaja <marko.tiikkaja@2ndquadrant.com>
To: Josh Berkus <josh@agliodbs.com>
Cc: pgsql-hackers@postgresql.org
Date: 2011-06-13T23:00:34Z
Lists: pgsql-hackers

Commits

Same data as JSON: GET /api/v1/messages/:b64id/commits the thread's linked commits as JSON, with link sources. API reference →
  1. Fix pg_get_constraintdef to cope with NOT VALID constraints

On 14/06/2011 01:11, Josh Berkus wrote:
> Hmmm. Is this the behavior we want with NOT VALID constraints though?
>
> I know that if I'm pouring 100m rows into a new partition as part of a
> repartitioning scheme, I don't want to *ever* check them if I know
> they're correct because of how I created the table (CREATE TABLE AS ...).

I can see why you would want that, but I'd say that's a separate feature 
you need to explicitly request when creating the constraint.  Consider 
what happens in the "old data is garbage, but I want the new data to be 
validated" use case if we allow constraint exclusion on NOT VALID 
constraints.


-- 
Marko Tiikkaja                http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services