Re: [HACKERS] DROP COLUMN round 4 - Mailing list pgsql-patches

From Christopher Kings-Lynne
Subject Re: [HACKERS] DROP COLUMN round 4
Date
Msg-id GNELIHDDFBOCMGBFGEFOAEHBCDAA.chriskl@familyhealth.com.au
Whole thread Raw
In response to Re: [HACKERS] DROP COLUMN round 4  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: [HACKERS] DROP COLUMN round 4
List pgsql-patches
> This happens because indexes are marked DEPENDENCY_AUTO on their
> columns.  The drop will cascade to the index even under RESTRICT;
> if you have message level set to DEBUG1 or higher you'll be told
> about it, but otherwise the behavior is to zap the index quietly.

Ah doh.  I knew that as well.  I'll try a view or something then...

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

OK, in this statement:

ALTER TABLE child ADD FOREIGN KEY (a) REFERENCES parent(b);

It does not check that column b is not dropped (it does check "a").  It just
relies on the UNIQUE constraint not being present on b.  This should
probably be fixed...

Chris


pgsql-patches by date:

Previous
From: Tom Lane
Date:
Subject: Re: [HACKERS] DROP COLUMN round 4
Next
From: Thomas Lockhart
Date:
Subject: Re: int64 timestamp patch for contrib/pg_controldata