pgsql: Add stack depth check to QueueFKConstraintValidation().

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Add stack depth check to QueueFKConstraintValidation().
Date: 2026-05-26 15:58:33
Message-ID: E1wRuAr-001DQr-02@gemulon.postgresql.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Add stack depth check to QueueFKConstraintValidation().

QueueFKConstraintValidation() recurses through the partition hierarchy
to queue child constraint validations and to mark child rows as
validated. With a sufficiently deep partition tree, this can result
in a stack-overflow crash. Defend against that as we do elsewhere.

Bug: #19482
Reported-by: Alexander Lakhin <exclusion(at)gmail(dot)com>
Author: Ayush Tiwari <ayushtiwari(dot)slg01(at)gmail(dot)com>
Reviewed-by: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Discussion: https://postgr.es/m/19482-4cc37cbf52d55235@postgresql.org
Backpatch-through: 18

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/61ea5cc6a61ff9eb8b3d7b055e507a726e5856c7

Modified Files
--------------
src/backend/commands/tablecmds.c | 3 +++
1 file changed, 3 insertions(+)

Browse pgsql-committers by date

  From Date Subject
Next Message Bruce Momjian 2026-05-26 20:32:19 pgsql: doc PG 19 relnotes: various corrections
Previous Message Álvaro Herrera 2026-05-26 15:25:34 pgsql: Restructure repack worker teardown