From: | Robert Haas <robertmhaas(at)gmail(dot)com> |
---|---|
To: | Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org> |
Cc: | Pg Hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: creating CHECK constraints as NOT VALID |
Date: | 2011-05-31 16:36:26 |
Message-ID: | BANLkTimHPoEXGfdp=cckh0Ln_FAaCQJxdg@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Tue, May 31, 2011 at 12:04 PM, Alvaro Herrera
<alvherre(at)alvh(dot)no-ip(dot)org> wrote:
> This patch allows you to initially declare a CHECK constraint as NOT
> VALID, similar to what we already allow for foreign keys. That is, you
> create the constraint without scanning the table and after it is
> committed, it is enforced for new rows; later, all rows are checked by
> running ALTER TABLE VALIDATE CONSTRAINT, which doesn't need
> AccessExclusive thus allowing for better concurrency.
>
> The trickiest bit here was realizing that unlike FKs, check constraints
> do inherit, and so needed special treatment for recursion. Other than
> that I think this was pretty straightforward.
>
> I intend to attempt to apply this to NOT NULL constraints as well, once
> the patch to add them to pg_constraint is in.
Seems like a logical extension of what we have now.
--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company
From | Date | Subject | |
---|---|---|---|
Next Message | Alvaro Herrera | 2011-05-31 16:39:48 | Re: creating CHECK constraints as NOT VALID |
Previous Message | Kevin Grittner | 2011-05-31 16:35:01 | Re: creating CHECK constraints as NOT VALID |