DROP COLUMN round 4 - Mailing list pgsql-hackers

From Christopher Kings-Lynne
Subject DROP COLUMN round 4
Date
Msg-id GNELIHDDFBOCMGBFGEFOGEGKCDAA.chriskl@familyhealth.com.au
Whole thread Raw
Responses Re: DROP COLUMN round 4  (Tom Lane <tgl@sss.pgh.pa.us>)
Re: DROP COLUMN round 4  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
Hi All,

This is another cut of the DROP COLUMN patch.  I have split the drop
function into two parts - and now handle dependencies.

Problems:

1. It cascade deletes objects, but it _always_ cascades, no matter what
behaviour I specify.  Also, it doesn't give me indications that it's cascade
deleted an object.

2. I get this in my regression tests:

+ -- test inheritance
+ create table parent (a int, b int, c int);
+ insert into parent values (1, 2, 3);
+ alter table parent drop a;
+ create table child (d varchar(255)) inherits (parent);
+ insert into child values (12, 13, 'testing');
+ select * from parent;
+  b  | c
+ ----+----
+   2 |  3
+  12 | 13
+ (2 rows)
+
+ select * from child;
+  b  | c  |    d
+ ----+----+---------
+  12 | 13 | testing
+ (1 row)
+
+ alter table parent drop c;
+ select * from parent;
+  b
+ ----
+   2
+  12
+ (2 rows)
+
+ select * from child;
+  b  |    d
+ ----+---------
+  12 | testing
+ (1 row)
+
+ drop table child;
+ ERROR:  RelationForgetRelation: relation 143905 is still open
+ drop table parent;
+ NOTICE:  table child depends on table parent
+ ERROR:  Cannot drop table parent because other objects depend on it
+       Use DROP ... CASCADE to drop the dependent objects too


What's with the RelationForgetRelation error???  Am I not closing some
handle somewhere?

Lastly, do we want new SearchSysCache functions or not?  I'd be more than
happy for Tom or someone to take this patch off my hands and polish it off -
especially since it's required for proper dependency handling and the beta
date is approaching...

Chris

Attachment

pgsql-hackers by date:

Previous
From: "Christopher Kings-Lynne"
Date:
Subject: Re: Weird manual page
Next
From: Oleg Bartunov
Date:
Subject: Re: Weird manual page