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

From Catalin(ux) M. Boie
Subject Re: [GENERAL] Forcefully adding a CHECK constrained
Date
Msg-id 201205280610.q4S69s0W020957@mail.embedromix.ro
Whole thread Raw
Responses Re: Re: [GENERAL] Forcefully adding a CHECK constrained
List pgsql-general
Hello.

Now I understand why I was not clear.

From what I understood, NOT VALID feature will not allow for the CHECK to be used in queries. So, for partitioning, my goal, is critical that the CHECK condition to be used.

I hope I make myself clear now: I want a possibility to add a CHECK that will be used for partitioning without having to read all data for validation.

of course, as I said, I will implement the future if PostgreSQL developers think that is useful.

Thank you for your time.

--
Catalin(ux) M. BOIE
http://kernel.embedromix.ro

----- Reply message -----
From: "Jeff Davis" <pgsql@j-davis.com>
To: "Catalin(ux) M. Boie" <catab@embedromix.ro>
Cc: <pgsql-general@postgresql.org>
Subject: [GENERAL] Forcefully adding a CHECK constrained
Date: Sun, May 27, 2012 19:46


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: Karl Denninger
Date:
Subject: Re: Attempting to do a rolling move to 9.2Beta (as a slave) fails
Next
From: Marti Raudsepp
Date:
Subject: Re: Forcefully adding a CHECK constrained