It's possible for dropping a column, or altering its type, to require changes in domain CHECK constraint expressions; but the code was previously only expecting to find dependent table CHECK constraints. Make the necessary adjustments.
This is a fairly old oversight, but it's a lot easier to encounter the problem in the context of domains over composite types than it was before. Given the lack of field complaints, I'm not going to bother with a back-patch, though I'd be willing to reconsider that decision if someone does complain.
Patch by me, reviewed by Michael Paquier
af20e2d728 Fix ALTER TABLE code to update domain constraints when needed.
src/backend/commands/tablecmds.c | 98 ++++++++++++++++++++++++++++++------
src/backend/utils/adt/ruleutils.c | 67 ++++++++++++++++++++----
src/include/nodes/parsenodes.h | 1 +
src/test/regress/expected/domain.out | 25 +++++++++
src/test/regress/sql/domain.sql | 20 ++++++++
5 files changed, 186 insertions(+), 25 deletions(-)