Re: creating CHECK constraints as NOT VALID

From: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
To: Thom Brown <thom(at)linux(dot)com>
Cc: Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: creating CHECK constraints as NOT VALID
Date: 2011-06-03 16:58:11
Message-ID: 1307120026-sup-4605@alvh.no-ip.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Excerpts from Thom Brown's message of vie jun 03 12:47:58 -0400 2011:
> On 2 June 2011 17:48, Alvaro Herrera <alvherre(at)commandprompt(dot)com> wrote:

> > Actually, it turns out that NOT VALID foreign keys were already buggy
> > here, and fixing them automatically fixes this case as well, because the
> > fix involves touching pg_get_constraintdef to dump the flag.  This also
> > gets it into psql's \d.  Patch attached.
> >
> > (Maybe the changes in psql's describe.c should be reverted, not sure.)
>
> Nice work Alvaro :) Shouldn't patches be sent to -hackers instead of
> the obsolete -patches list? Plus I'm a bit confused as to why the
> patch looks like an email instead of a patch.

Did I really email pgsql-patches? If so, I didn't notice -- but I don't
see it (and the archives seem to agree with me, there's no email after
2008-10).

The patch looks like an email because that's what git format-patch
produced, and I attached it instead of putting it inline.

> According to the SQL:2011 standard: "The SQL Standard allows you to
> turn the checking on and off for CHECK constraints, UNIQUE constraints
> and FOREIGN KEYS."
>
> So is it much work to also add the ADD CONSTRAINT UNIQUE (column, ...)
> NOT VALID syntax to this too? This would mean we're completely
> covered for this standards requirement.

Yeah, UNIQUE is a completely different beast. There's already some work
on making them accept invalid (duplicate) values temporarily, but making
that more general, even if it was acceptable to the community at large
(which I'm not sure it is) is way beyond what I set to do here :-)

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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message David E. Wheeler 2011-06-03 17:00:07 Re: Domains versus polymorphic functions, redux
Previous Message Radosław Smogura 2011-06-03 16:50:21 Re: BLOB support