Fix error message for ALTER CONSTRAINT ... NOT VALID
Álvaro Herrera <alvherre@kurilemu.de>
Fix error message for ALTER CONSTRAINT ... NOT VALID Trying to alter a constraint so that it becomes NOT VALID results in an error that assumes the constraint is a foreign key. This is potentially wrong, so give a more generic error message. While at it, give CREATE CONSTRAINT TRIGGER a better error message as well. Co-authored-by: jian he <jian.universality@gmail.com> Co-authored-by: Fujii Masao <masao.fujii@oss.nttdata.com> Co-authored-by: Álvaro Herrera <alvherre@kurilemu.de> Co-authored-by: Amul Sul <sulamul@gmail.com> Discussion: https://postgr.es/m/CACJufxHSp2puxP=q8ZtUGL1F+heapnzqFBZy5ZNGUjUgwjBqTQ@mail.gmail.com
Files
| Path | Change | +/− |
|---|---|---|
| src/backend/parser/gram.y | modified | +6 −0 |
| src/test/regress/expected/constraints.out | modified | +5 −0 |
| src/test/regress/expected/foreign_key.out | modified | +1 −1 |
| src/test/regress/sql/constraints.sql | modified | +3 −0 |
Discussion
- ALTER TABLE ALTER CONSTRAINT misleading error message 18 messages · 2025-05-28 → 2025-07-03