Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1wRuC3-002nLv-1v for pgsql-bugs@arkaria.postgresql.org; Tue, 26 May 2026 15:59:47 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1wRuC1-0052EY-1x for pgsql-bugs@arkaria.postgresql.org; Tue, 26 May 2026 15:59:46 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1wRuC1-0052EP-1A for pgsql-bugs@lists.postgresql.org; Tue, 26 May 2026 15:59:46 +0000 Received: from sss.pgh.pa.us ([68.162.161.243]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1wRuC0-00000000sPh-2Hy9 for pgsql-bugs@lists.postgresql.org; Tue, 26 May 2026 15:59:45 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.18.1/8.18.1) with ESMTP id 64QFxhGG083705; Tue, 26 May 2026 11:59:43 -0400 From: Tom Lane To: Ayush Tiwari cc: exclusion@gmail.com, pgsql-bugs@lists.postgresql.org Subject: Re: BUG #19482: Recursive QueueFKConstraintValidation() lacks stack depth check In-reply-to: References: <19482-4cc37cbf52d55235@postgresql.org> Comments: In-reply-to Ayush Tiwari message dated "Sun, 17 May 2026 20:14:24 +0530" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <83703.1779811183.1@sss.pgh.pa.us> Date: Tue, 26 May 2026 11:59:43 -0400 Message-ID: <83704.1779811183@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Ayush Tiwari 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