Re: Check constraints on partition parents only? - Mailing list pgsql-hackers

From Robert Haas
Subject Re: Check constraints on partition parents only?
Date
Msg-id CA+TgmoYQYRn=EmGaA6uaTvwwHqFAbD-et=j3zTfyusFbNJy2cg@mail.gmail.com
Whole thread Raw
In response to Re: Check constraints on partition parents only?  (Nikhil Sontakke <nikhil.sontakke@enterprisedb.com>)
Responses Re: Check constraints on partition parents only?
List pgsql-hackers
On Thu, Jul 28, 2011 at 9:43 AM, Nikhil Sontakke
<nikhil.sontakke@enterprisedb.com> wrote:
> Alternatively we could bring about the same
> by using a combination of conislocal and coninhcnt. For ONLY constraints, we
> will need to percolate this information down to the point where we define it
> in the code. We can then mark ONLY constraints to have conislocal set to
> TRUE and coninhcnt set to a special value (-1)

This approach certainly can't work, because a table can be both an
inheritance parent and an inheritance child.  It could have an ONLY
constraint, and also inherit a copy of the same constraint for one or
more parents.  IOW, the fact that conislocal = true does not mean that
coninhcount is irrelevant.  I think what you probably want to do is
either (a) add a new column or (b) change conislocal to a char value
and make it three-valued:

n = inherited constraint, no local definition
o = defined locally as an "ONLY" constraint
i = defined locally as a non-ONLY constraint

I think I favor the latter approach as more space-efficient, but I
hear Tom muttering about backward-compatibility...

-- 
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company


pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: Check constraints on partition parents only?
Next
From: Nikhil Sontakke
Date:
Subject: Re: Check constraints on partition parents only?