Re: Check constraints on partition parents only?

From: Andrew Dunstan <andrew(at)dunslane(dot)net>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: Nikhil Sontakke <nikhil(dot)sontakke(at)enterprisedb(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-26 13:33:51
Message-ID: 4E2EC23F.1000306@dunslane.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 07/26/2011 09:08 AM, Robert Haas wrote:
> On Tue, Jul 26, 2011 at 4:12 AM, Nikhil Sontakke
> <nikhil(dot)sontakke(at)enterprisedb(dot)com> wrote:
>>> Yeah. I think it's good that there's a barrier to blindly dropping a
>>> constraint that may be important to have on children, but there should
>>> be a way to override that.
>> Hmmm, but then it does open up the possibility of naive users shooting
>> themselves in the foot. It can be easy to conjure up a
>> parent-only-constraint that does not gel too well with its children. And
>> that's precisely why this feature was added in the first place..
> 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.

cheers

andrew

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tim Lewis 2011-07-26 13:44:14 Re: vacuumlo patch
Previous Message Andrew Dunstan 2011-07-26 13:20:36 longstanding mingw warning