Re: BUG #19482: Recursive QueueFKConstraintValidation() lacks stack depth check

Tom Lane <tgl@sss.pgh.pa.us>

From: Tom Lane <tgl@sss.pgh.pa.us>
To: Ayush Tiwari <ayushtiwari.slg01@gmail.com>
Cc: exclusion@gmail.com, pgsql-bugs@lists.postgresql.org
Date: 2026-05-26T15:59:43Z
Lists: pgsql-bugs
Ayush Tiwari <ayushtiwari.slg01@gmail.com> writes:
> QueueFKConstraintValidation() recurses through the partition hierarchy
> without a stack-depth check, which is the usual reason for SIGSEGV
> crashes like the one in your stack trace.  Other recursive helpers in
> tablecmds.c (and elsewhere in the backend) call check_stack_depth() at
> function entry so that we raise a controlled "stack depth limit
> exceeded" error instead.

> The attached patch does the same here.  With max_stack_depth reduced
> to 100kB, a scaled-down repro (2000 nested partitions) reproduces the
> crash on master and produces the following clean error with the patch:

Thanks for the patch, pushed.

			regards, tom lane



Commits

Same data as JSON: GET /api/v1/messages/:b64id/commits the thread's linked commits as JSON, with link sources. API reference →
  1. Add stack depth check to QueueFKConstraintValidation().