Peter Eisentraut <peter_e@gmx.net> writes:
> 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.
Wouldn't help much: when you do a DROP TRIGGER, do you turn off the
attisusedbytrigger, or not? You'd still end up scanning everything,
just at a different time.
Maybe if it were a reference count, and not just a bit --- but I'd sure
hate to try to guarantee that we maintain the reference count
accurately.
regards, tom lane