From: | "Charles Clavadetscher" <clavadetscher(at)swisspug(dot)org> |
---|---|
To: | "'Vitaly Burovoy'" <vitaly(dot)burovoy(at)gmail(dot)com>, "'Christophe Pettus'" <xof(at)thebuild(dot)com> |
Cc: | "'Postgres General'" <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: ERROR: check constraint - PostgreSQL 9.2 |
Date: | 2016-01-25 13:50:12 |
Message-ID: | 009d01d15777$57000980$05001c80$@swisspug.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Hello Vitaly
> -----Original Message-----
> From: Vitaly Burovoy [mailto:vitaly(dot)burovoy(at)gmail(dot)com]
> Sent: Montag, 25. Januar 2016 14:25
> To: Christophe Pettus <xof(at)thebuild(dot)com>; clavadetscher(at)swisspug(dot)org
> Cc: Postgres General <pgsql-general(at)postgresql(dot)org>
> Subject: Re: [GENERAL] ERROR: check constraint - PostgreSQL 9.2
>
> On 1/24/16, Christophe Pettus <xof(at)thebuild(dot)com> wrote:
> >
> > On Jan 24, 2016, at 9:01 PM, Charles Clavadetscher
> > <clavadetscher(at)swisspug(dot)org> wrote:
> >
> >> What is the point of having a check constraint that is not checked?
> >
> > Well, it *is* checked going into the future; it's just not checked at the
> > time the constraint is added. Ultimately, you do want to fix the data, but
> > this makes it a two-step process, and reduces the time the table is locked
> > against access.
>
> NOT VALID constraint checks new and updated rows, and gives an extra
> time to fix current data and be sure there will be no new rows that
> violates the check constraint during and after the fixing process.
>
> N.B.: Prior 9.4 it does *NOT* reduce the time the table is locked
> because VALIDATE CONSTRAINT requires ACCESS EXCLUSIVE[1] and uses
> seqscan for check table's rows.
>
> P.S. Lucas, If you have not received answers, you can find all of them
> as a thread by the link:
> http://www.postgresql.org/message-id/flat/CAE_gQfXTns1FR5Fx9wxpo1oZYwat639ua-gAqWZyNg201HCU=Q(at)mail(dot)gmail(dot)com
>
> P.P.S.: Christophe, Charles! Please, use "Relpy to all" to be sure
> the sender gets your answers even if he haven't subscribed to the
> mailing list.
Oops. Honestly I did not think of that. I will keep that in mind in the future.
Thank you for the hint.
Charles
>
> [1]http://www.postgresql.org/docs/9.2/static/sql-altertable.html
> --
> Best regards,
> Vitaly Burovoy
From | Date | Subject | |
---|---|---|---|
Next Message | Shulgin, Oleksandr | 2016-01-25 16:16:35 | Re: help:error while running postgres after installing postgresql server from source code |
Previous Message | Vitaly Burovoy | 2016-01-25 13:24:45 | Re: ERROR: check constraint - PostgreSQL 9.2 |