Enforce pg_class.relchecks limit (32,767 or INT16_MAX) pg_class.relchecks reports the number of CHECK constraints in a table, and is stored within a smallint. It was possible to define a table that could overflow the counter when specifying more than 32k constraints (new table or adding a constraint). This would cause the table to become undroppable, as this counter should never be negative when dropping these constraints.
Author: Matthias van de Meent <[email protected]> Reviewed-by: Bertrand Drouvot <[email protected]> Reviewed-by: Jian He <[email protected]> Reviewed-by: Sivaprasad <[email protected]> Discussion: https://postgr.es/m/caeze2wjsw4qahynvkttbknp85egeirgjtlmzatotdjjkia+...@mail.gmail.com Backpatch-through: 14 Branch ------ REL_17_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/9ca1d5726c21e3ae182ce461d439e360a0658ad8 Modified Files -------------- doc/src/sgml/limits.sgml | 7 +++++++ src/backend/catalog/heap.c | 28 +++++++++++++++++++++++----- 2 files changed, 30 insertions(+), 5 deletions(-)
