Skip site navigation (1) Skip section navigation (2)

Re: [HACKERS] DROP COLUMN round 4

From: "Christopher Kings-Lynne" <chriskl(at)familyhealth(dot)com(dot)au>
To: "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: "Patches" <pgsql-patches(at)postgresql(dot)org>
Subject: Re: [HACKERS] DROP COLUMN round 4
Date: 2002-07-31 05:29:24
Message-ID: GNELIHDDFBOCMGBFGEFOEEHACDAA.chriskl@familyhealth.com.au (view raw or flat)
Thread:
Lists: pgsql-hackerspgsql-patches
> "Christopher Kings-Lynne" <chriskl(at)familyhealth(dot)com(dot)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?

test=# create table test (a int4, b int4);
CREATE TABLE
test=# create index temp on test (a);
CREATE INDEX
test=# \dt
        List of relations
 Name | Schema | Type  |  Owner
------+--------+-------+---------
 test | public | table | chriskl
(1 row)

test=# \di
            List of relations
 Name | Schema | Type  |  Owner  | Table
------+--------+-------+---------+-------
 temp | public | index | chriskl | test
(1 row)

test=# alter table test drop a restrict;
ALTER TABLE
test=# \di
No relations found.
test=#

> > + 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.

Fixed.  New diff attached - fixes regression tests as well, plus re-merged
against HEAD.

Note that the check against the parent attribute when adding a foreign key
probably should be improved.  ie. It relies on the fact that the parent
column(s) should not have a unique index on them (thanks to dependencies),
rather than actually checking the attisdropped attribute.

Chris

Attachment: dropcolumn5.txt.gz
Description: application/x-gzip (17.2 KB)

In response to

Responses

pgsql-hackers by date

Next:From: Curt SampsonDate: 2002-07-31 05:37:20
Subject: Re: Rules and Views
Previous:From: Tom LaneDate: 2002-07-31 05:22:20
Subject: Re: Rules and Views

pgsql-patches by date

Next:From: Tom LaneDate: 2002-07-31 05:44:06
Subject: Re: [HACKERS] DROP COLUMN round 4
Previous:From: Tatsuo IshiiDate: 2002-07-31 05:24:36
Subject: SQL99 CONVERT patch

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group