Обсуждение: DROP COLUMN round 4

Поиск
Список
Период
Сортировка

DROP COLUMN round 4

От
"Christopher Kings-Lynne"
Дата:
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

Вложения

Re: DROP COLUMN round 4

От
Tom Lane
Дата:
"Christopher Kings-Lynne" <chriskl@familyhealth.com.au> writes:
> ... 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...

I'm out from under CREATE/DROP OPERATOR CLASS now, so I'll take a
look...
        regards, tom lane


Re: DROP COLUMN round 4

От
Tom Lane
Дата:
"Christopher Kings-Lynne" <chriskl@familyhealth.com.au> writes:
> 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.

Would you give a specific example?

> + drop table child;
> + ERROR:  RelationForgetRelation: relation 143905 is still open

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

AlterTableDropColumn neglects to heap_close the relation, but I'm
surprised that error isn't reported sooner.
        regards, tom lane