Re: Primary Key Constraint on inheritance table not getting route to child tables

From: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>
To: Rushabh Lathia <rushabh(dot)lathia(at)gmail(dot)com>
Cc: Pg Hackers <pgsql-hackers(at)postgresql(dot)org>, Rushabh Lathia <rushabh(dot)lathia(at)enterprisedb(dot)com>
Subject: Re: Primary Key Constraint on inheritance table not getting route to child tables
Date: 2012-08-20 15:39:06
Message-ID: 1345472788-sup-2672@alvh.no-ip.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Excerpts from Rushabh Lathia's message of lun ago 20 02:50:52 -0400 2012:
> Hi,
>
> ALTER TABLE ADD Constraints PRIMARY KEY on inheritance table not getting
> route to child table.
>
> But when we do ALTER TABLE DROP Constraint on the same, it complains about
> constraint does not
> exists on child table.

This is a known 9.2 bug, fixed a month in this commit:

Author: Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>
Branch: master [f5bcd398a] 2012-07-20 14:08:07 -0400
Branch: REL9_2_STABLE [d721f208a] 2012-07-20 14:07:09 -0400

connoinherit may be true only for CHECK constraints

The code was setting it true for other constraints, which is
bogus. Doing so caused bogus catalog entries for such constraints, and
in particular caused an error to be raised when trying to drop a
constraint of types other than CHECK from a table that has children,
such as reported in bug #6712.

In 9.2, additionally ignore connoinherit=true for other constraint
types, to avoid having to force initdb; existing databases might already
contain bogus catalog entries.

Includes a catversion bump (in HEAD only).

Bug report from Miroslav Šulc
Analysis from Amit Kapila and Noah Misch; Amit also contributed the patch.

I cannot reproduce it in 9.2 HEAD or master HEAD. I assume you were
testing with something older than the above commit; the 9.1 branch does
not contain the bug.

--
Álvaro Herrera http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2012-08-20 15:43:44 Re: The pgrminclude problem
Previous Message Robert Haas 2012-08-20 15:39:05 Re: Avoiding repeated snapshot computation