Re: [BUGS] BUG #6712: PostgreSQL 9.2 beta2: alter table drop constraint does not work on inherited master table

2012-08-30 Thread Bruce Momjian
On Mon, Jul  2, 2012 at 04:16:31PM +0530, Amit Kapila wrote:
  From: pgsql-bugs-ow...@postgresql.org 
  [mailto:pgsql-bugs-ow...@postgresql.org] On Behalf Of 
  miroslav.s...@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 Šulc
  Email address:  miroslav.s...@fordfrog.com
  PostgreSQL version: Unsupported/Unknown
  Operating system:   Gentoo Linux
  Description:
 
  here is the test case:
 
  test=# create table test_constraints (id int, val1 varchar, val2 int, unique
  (val1, val2));
  NOTICE:  CREATE TABLE / UNIQUE will create implicit index
  test_constraints_val1_val2_key for table test_constraints
  CREATE TABLE
  test=# create table test_constraints_inh () inherits (test_constraints);
  CREATE TABLE
  test=# 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_val1_val2_key con-connoinherit is false, 
 due to which it tries to drop the constrint from child table as well. 
 I have checked that from function index_constraint_create() when it calls 
 function CreateConstraintEntry(), the flag for noinherit passed is false. 
 I think this is the reason of failure for the same.

I believe this if fixed in all current versions of Postgres.  I tested
9.1, 9.2rc1, and 9.3.

-- 
  Bruce Momjian  br...@momjian.ushttp://momjian.us
  EnterpriseDB http://enterprisedb.com

  + It's impossible for everything to be true. +


-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs


Re: [BUGS] BUG #6712: PostgreSQL 9.2 beta2: alter table drop constraint does not work on inherited master table

2012-07-20 Thread Alvaro Herrera

Excerpts from Amit Kapila's message of jue jul 19 22:57:04 -0400 2012:
 From: Noah Misch [mailto:n...@leadboat.com] 
 Sent: Thursday, July 19, 2012 5:23 PM
 On Tue, Jul 17, 2012 at 08:59:50AM +, Amit kapila wrote:
  Patch is attached with this mail.
 
  Thanks.  This patch is ready for committer.

Thanks, will see about it.

-- 
Álvaro Herrera alvhe...@commandprompt.com
The PostgreSQL Company - Command Prompt, Inc.
PostgreSQL Replication, Consulting, Custom Development, 24x7 support

-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs


Re: [BUGS] BUG #6712: PostgreSQL 9.2 beta2: alter table drop constraint does not work on inherited master table

2012-07-19 Thread Amit Kapila
From: Noah Misch [mailto:n...@leadboat.com] 
Sent: Thursday, July 19, 2012 5:23 PM
On Tue, Jul 17, 2012 at 08:59:50AM +, Amit kapila wrote:
 Patch is attached with this mail.

 Thanks.  This patch is ready for committer.

 +-- Test non-inheritable indices [UNIQUE, EXCLUDE] contraints
 +CREATE TABLE test_constraints (id int, val1 varchar, val2 int,
UNIQUE(val1, val2));
 +CREATE TABLE test_constraints_inh () INHERITS (test_constraints);
 +\d+ test_constraints
 +ALTER TABLE ONLY test_constraints DROP CONSTRAINT
test_constraints_val1_val2_key;
 +\d+ test_constraints
 +\d+ test_constraints_inh

 To keep output terse, I would have omitted \d commands or retained only
the
 post-DROP \d+ test_constraints.  Granted, that's subjective.

Thanks for the review of patch.

With Regards,
Amit Kapila.


-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs


Re: [BUGS] BUG #6712: PostgreSQL 9.2 beta2: alter table drop constraint does not work on inherited master table

2012-07-16 Thread Amit Kapila
From: Noah Misch [mailto:n...@leadboat.com] 
Sent: Monday, July 16, 2012 2:54 AM
  From: pgsql-bugs-ow...@postgresql.org
[mailto:pgsql-bugs-ow...@postgresql.org] On Behalf Of
miroslav.s...@fordfrog.com
  Sent: Saturday, June 30, 2012 4:28 PM


 Care to prepare a patch with a test case addition?
  Yes. I have started working.

With Regards,
Amit Kapila.


-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs


Re: [BUGS] BUG #6712: PostgreSQL 9.2 beta2: alter table drop constraint does not work on inherited master table

2012-07-16 Thread Amit Kapila
From: Noah Misch [mailto:n...@leadboat.com] 
Sent: Monday, July 16, 2012 2:54 AM

 One can construct similar bugs around dropping foreign key and exclusion
 constraints.  Though it may be irrelevant for command semantics,
additionally
 using connoinherit = 't' for contype = 't' (CONSTRAINT_TRIGGER) would
 more-accurately represent the nature of those constraints.

Code Changes

I will make changes in following functions to ensure that connoinherit
should be appropriately set(pass the value as true).  
a. index_constraint_create() 
b. ATAddForeignKeyConstraint() 
c. CreateTrigger().

Other places I have checked seems to be fine.

Test

I will create testcases similar to mentioned in bug report for
a. unique key case, same as in bug-report
b. foreign key case
c. exclusion constraint case 


 Care to prepare a patch with a test case addition?
 Let me know if above is sufficient or shall I include anything more in
patch.


With Regards,
Amit Kapila.


-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs