Re: BUG #6712: PostgreSQL 9.2 beta2: alter table drop constraint does not work on inherited master table - Mailing list pgsql-bugs

From Amit Kapila
Subject Re: BUG #6712: PostgreSQL 9.2 beta2: alter table drop constraint does not work on inherited master table
Date
Msg-id 008101cd583f$f184ab40$d48e01c0$@kapila@huawei.com
Whole thread Raw
In response to BUG #6712: PostgreSQL 9.2 beta2: alter table drop constraint does not work on inherited master table  (miroslav.sulc@fordfrog.com)
Responses Re: BUG #6712: PostgreSQL 9.2 beta2: alter table drop constraint does not work on inherited master table  (Bruce Momjian <bruce@momjian.us>)
List pgsql-bugs
> From: pgsql-bugs-owner@postgresql.org [mailto:pgsql-bugs-owner@postgresql=
.org] On Behalf Of miroslav.sulc@fordfrog.com
> Sent: Saturday, June 30, 2012 4:28 PM
> The following bug has been logged on the website:

> Bug reference:      6712
> Logged by:          Miroslav =C5=A0ulc
> Email address:      miroslav.sulc@fordfrog.com
> PostgreSQL version: Unsupported/Unknown
> Operating system:   Gentoo Linux
> Description:=20=20=20=20=20=20=20=20

> here is the test case:

> test=3D# create table test_constraints (id int, val1 varchar, val2 int, u=
nique
> (val1, val2));
> NOTICE:  CREATE TABLE / UNIQUE will create implicit index
> "test_constraints_val1_val2_key" for table "test_constraints"
> CREATE TABLE
> test=3D# create table test_constraints_inh () inherits (test_constraints);
> CREATE TABLE
> test=3D# alter table only test_constraints drop constraint
> test_constraints_val1_val2_key;
> ERROR:  constraint "test_constraints_val1_val2_key" of relation
> "test_constraints_inh" does not exist


> postgresql tries to drop the constraint even from descendant table though
> "only" is specified.


In function ATExecDropConstraint(), for the constarint "test_constraints_va=
l1_val2_key" con->connoinherit is false,=20
due to which it tries to drop the constrint from child table as well.=20
I have checked that from function index_constraint_create() when it calls f=
unction CreateConstraintEntry(), the flag for noinherit passed is false.=20
I think this is the reason of failure for the same.

With Regards,
Amit Kapila.

pgsql-bugs by date:

Previous
From: "Greg Sabino Mullane"
Date:
Subject: Re: BUG #6707: ERROR: could not open relation with OID
Next
From: Andrzej Krawiec
Date:
Subject: Re: BUG #6650: CPU system time utilization rising few times a day