pgsql: Don't error out when dropping constraint if relchecks is already - Mailing list pgsql-committers

From Álvaro Herrera
Subject pgsql: Don't error out when dropping constraint if relchecks is already
Date
Msg-id E1vDoCo-003xd9-2L@gemulon.postgresql.org
Whole thread Raw
List 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@kurilemu.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(-)


pgsql-committers by date:

Previous
From: Jeff Davis
Date:
Subject: pgsql: Move comment about casts from pg_wchar.
Next
From: Peter Eisentraut
Date:
Subject: pgsql: formatting.c cleanup: Remove dashes in comments