Skip site navigation (1) Skip section navigation (2)

Re: Check constraints on partition parents only?

From: Nikhil Sontakke <nikhil(dot)sontakke(at)enterprisedb(dot)com>
To: Andrew Dunstan <andrew(at)dunslane(dot)net>
Cc: Robert Haas <robertmhaas(at)gmail(dot)com>, Alvaro Herrera <alvherre(at)commandprompt(dot)com>, Jerry Sievers <gsievers19(at)comcast(dot)net>, Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Check constraints on partition parents only?
Date: 2011-07-27 10:39:59
Message-ID: CABamaqNMDBJFTMQk8FzugZG6uZvvQ+DprBEcbRGnSWkB-qW3EA@mail.gmail.com (view raw or flat)
Thread:
Lists: pgsql-hackers
Hi,


>  Yeah, but I think we need to take that chance.  At the very least, we
>> need to support the equivalent of a non-inherited CHECK (false) on
>> parent tables.
>>
>
> Indeed. I usually enforce that with a trigger that raises an exception, but
> of course that doesn't help at all with constraint exclusion, and I saw a
> result just a few weeks ago (I forget the exact details) where it appeared
> that the plan chosen was significantly worse because the parent table wasn't
> excluded, so there's a  non-trivial downside from having this restriction.
>
>
The downside appears to be non-trivial indeed! I cooked up the attached
patch to try to allow ALTER...ONLY...CHECK(false) on parent tables.

If this approach looks acceptable, I can provide a complete patch later with
some documentation changes (I think we ought to tell about this special case
in the documentation) and a minor test case along with it (if the need be
felt for the test case).

Although partitioning ought to be looked at from a different angle
completely, maybe this small patch can help out a bit in the current scheme
of things, although this is indeed a unusual special casing... Thoughts?

Regards,
Nikhils

Attachment: special_case_CHECK_parent.patch
Description: text/x-patch (1.8 KB)

In response to

Responses

pgsql-hackers by date

Next:From: Alexander KorotkovDate: 2011-07-27 12:29:04
Subject: Re: WIP: Fast GiST index build
Previous:From: Petro MeierDate: 2011-07-27 06:51:22
Subject: PQescapeByteaConn - returns wrong string for PG9.1 Beta3

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group