Re: [HACKERS] Happy column dropping

Peter Eisentraut <peter_e@gmx.net>

From: Peter Eisentraut <peter_e@gmx.net>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: PostgreSQL Development <pgsql-hackers@postgresql.org>
Date: 2000-01-24T23:48:47Z
Lists: pgsql-hackers
On 2000-01-22, Tom Lane mentioned:

> > 2) how do I find out if the dropped column is referenced in a constraint,
> > trigger, rule (this is necessary for a correct RESTRICT/CASCADE
> > implementation)
> 
> Actually it's worse than that: you need to be prepared to renumber the
> columns after the dropped one, too.  Probably what you will need to do
> is read in and deparse all the relevant rules and triggers, then reparse
> them against the updated table schema.  Ugly.  And no, I have no idea
> how you even *find* all the relevant rules.  (Jan?)

Perhaps their should be a pg_attribute.attisusedbytrigger::oid,
pg_attribute.attisconstrainedbyconstr::oid, etc. Eventually, I think, this
is unavoidable if you want DROP TABLE to do the right thing as well, and
scanning and decoding possibly hundreds of rules, triggers, and
constraints won't get you far.


-- 
Peter Eisentraut                  Sernanders väg 10:115
peter_e@gmx.net                   75262 Uppsala
http://yi.org/peter-e/            Sweden