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

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Ayush Tiwari <ayushtiwari(dot)slg01(at)gmail(dot)com>
Cc: exclusion(at)gmail(dot)com, pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: BUG #19482: Recursive QueueFKConstraintValidation() lacks stack depth check
Date: 2026-05-26 15:59:43
Message-ID: 83704.1779811183@sss.pgh.pa.us
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Ayush Tiwari <ayushtiwari(dot)slg01(at)gmail(dot)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

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Pierre Forstmann 2026-05-26 17:52:03 Re: BUG #19493: Assertion failure in pg_plan_advice with EXISTS subquery and DO_NOT_SCAN advice
Previous Message PG Bug reporting form 2026-05-26 14:44:38 BUG #19493: Assertion failure in pg_plan_advice with EXISTS subquery and DO_NOT_SCAN advice