Обсуждение: pgsql: Don't error out when dropping constraint if relchecks is already

Поиск
Список
Период
Сортировка

pgsql: Don't error out when dropping constraint if relchecks is already

От
Álvaro Herrera
Дата:
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(-)