Re: Forcefully adding a CHECK constrained

From: Jeff Davis <pgsql(at)j-davis(dot)com>
To: "Catalin(ux) M(dot) Boie" <catab(at)embedromix(dot)ro>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Forcefully adding a CHECK constrained
Date: 2012-05-27 16:46:08
Message-ID: 1338137168.29608.78.camel@jdavis
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Marti Raudsepp 2012-05-27 18:22:45 Re: PG vs MSSQL language comparison ?
Previous Message F. BROUARD / SQLpro 2012-05-27 08:46:21 Re: PG vs MSSQL language comparison ?