I wrote: > That TODO item should either be removed or marked with a warning stating > that it's next door to impossible. (Unfortunately, a lot of our TODO > items are like that ... there's usually a good reason why they're not > done already.)
Actually ... I'm not sure if this idea has been discussed before, but what if we redefined what "delete" means? We could add an "isdropped" column to pg_enum, and have DROP do nothing but set that flag, and modify enum_in to reject such values. Then comparisons still work, and whether there are remaining instances of the value is the user's problem not ours. pg_dump and pg_upgrade would need to jump through some hoops to deal with this, but it's not any harder than a lot of other weird cases they deal with. regards, tom lane