Re: [GENERAL] Forcefully adding a CHECK constrained

From: Catalin(ux) M(dot) Boie <catab(at)embedromix(dot)ro>
To: Jeff Davis <pgsql(at)j-davis(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: [GENERAL] Forcefully adding a CHECK constrained
Date: 2012-05-28 06:13:36
Message-ID: 201205280610.q4S69s0W020957@mail.embedromix.ro
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)j-davis(dot)com>
To: "Catalin(ux) M. Boie" <catab(at)embedromix(dot)ro>
Cc: <pgsql-general(at)postgresql(dot)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

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Marti Raudsepp 2012-05-28 08:11:23 Re: Forcefully adding a CHECK constrained
Previous Message Karl Denninger 2012-05-28 04:14:52 Re: Attempting to do a rolling move to 9.2Beta (as a slave) fails