Re: Forcefully adding a CHECK constrained - Mailing list pgsql-general

From Jeff Davis
Subject Re: Forcefully adding a CHECK constrained
Date
Msg-id 1338137168.29608.78.camel@jdavis
Whole thread Raw
In response to Forcefully adding a CHECK constrained  ("Catalin(ux) M. BOIE" <catab@embedromix.ro>)
List pgsql-general
On Sat, 2012-05-26 at 22:06 +0300, Catalin(ux) M. Boie wrote:
> Hello.
> Thanks for the answer.
>
> I really want to avoid reading the whole table. It is too expensive,
> and with the proposed feature will be not needed. I think is much
> faster to forcefully add the check if you know the range of data.
>
> What do you think?

Why not just create the CHECK constraint as NOT VALID, and never
validate it? It will still enforce the constraint, it just won't
validate it against your old data, which sounds like what you want.

Regards,
    Jeff Davis


pgsql-general by date:

Previous
From: "F. BROUARD / SQLpro"
Date:
Subject: Re: PG vs MSSQL language comparison ?
Next
From: Marti Raudsepp
Date:
Subject: Re: PG vs MSSQL language comparison ?