| From: | Álvaro Herrera <alvherre(at)kurilemu(dot)de> |
|---|---|
| To: | pgsql-committers(at)lists(dot)postgresql(dot)org |
| Subject: | pgsql: Don't error out when dropping constraint if relchecks is already |
| Date: | 2025-10-28 18:14:02 |
| Message-ID: | E1vDoCo-003xd9-2L@gemulon.postgresql.org |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-committers |
Don't error out when dropping constraint if relchecks is already zero
I have never seen this be a problem in practice, but it came up when
purposely corrupting catalog contents to study the fix for a nearby bug:
we'd try to decrement relchecks, but since it's zero we error out and
fail to drop the constraint. The fix is to downgrade the error to
warning, skip decrementing the counter, and otherwise proceed normally.
Given lack of field complaints, no backpatch.
Author: Álvaro Herrera <alvherre(at)kurilemu(dot)de>
Discussion: https://postgr.es/m/202508291058.q2zscdcs64fj@alvherre.pgsql
Branch
------
master
Details
-------
https://git.postgresql.org/pg/commitdiff/d5845aa8adb25fda30cb2ad44aa2c5b0a59baa27
Modified Files
--------------
src/backend/catalog/pg_constraint.c | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Peter Eisentraut | 2025-10-28 18:34:29 | pgsql: formatting.c cleanup: Move loop variables definitions into for s |
| Previous Message | Jeff Davis | 2025-10-28 17:50:34 | pgsql: Move comment about casts from pg_wchar. |