Re: ERROR: check constraint - PostgreSQL 9.2 - Mailing list pgsql-general

From Charles Clavadetscher
Subject Re: ERROR: check constraint - PostgreSQL 9.2
Date
Msg-id 021201d1572d$873928b0$95ab7a10$@swisspug.org
Whole thread Raw
In response to Re: ERROR: check constraint - PostgreSQL 9.2  (Christophe Pettus <xof@thebuild.com>)
Responses Re: ERROR: check constraint - PostgreSQL 9.2  (Christophe Pettus <xof@thebuild.com>)
List pgsql-general
Hello

Althought both options are technically correct, I guess that the first one is the only reasonable one. What is the
pointof having a 
check constraint that is not checked? If all fields in the check constraint must not be null there must be a reason for
it.Possibly 
the "wrong" data is useless anyway (some test data that was not deleted) or the constraint only applies from a certain
pointin time 
because something in the system built on top of it changed. In the latter case, since the data has a time stamp you may
extendthe 
constraints to include the point in time from which it must apply.

Bye
Charles

> -----Original Message-----
> From: pgsql-general-owner@postgresql.org [mailto:pgsql-general-owner@postgresql.org] On Behalf Of Christophe Pettus
> Sent: Montag, 25. Januar 2016 05:18
> To: Postgres General <pgsql-general@postgresql.org>
> Subject: Re: [GENERAL] ERROR: check constraint - PostgreSQL 9.2
>
>
> On Jan 24, 2016, at 8:12 PM, "drum.lucas@gmail.com" <drum.lucas@gmail.com> wrote:
>
> > How can I solve the problem? How can I get the command successfully be done?
>
> Two options:
>
> 1. Fix the data.
>
> 2. Use the NOT VALID option on ALTER TABLE ... ADD constraint, which allows the addition of a constraint without
> actually checking its validity.
>
> --
> -- Christophe Pettus
>    xof@thebuild.com
>
>
>
> --
> Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-general



pgsql-general by date:

Previous
From: "Regina Obe"
Date:
Subject: Re: A motion
Next
From: Christophe Pettus
Date:
Subject: Re: ERROR: check constraint - PostgreSQL 9.2