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 1wNhzo-0010Km-0r for pgsql-hackers@arkaria.postgresql.org; Fri, 15 May 2026 02:09:48 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1wNhzk-00FrFr-2G for pgsql-hackers@arkaria.postgresql.org; Fri, 15 May 2026 02:09:44 +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 1wNhzk-00FrFi-1O for pgsql-hackers@lists.postgresql.org; Fri, 15 May 2026 02:09:44 +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 1wNhzb-00000000d7l-0MJL for pgsql-hackers@lists.postgresql.org; Fri, 15 May 2026 02:09:43 +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 64F29TQX1140011; Thu, 14 May 2026 22:09:29 -0400 From: Tom Lane To: Michael Paquier cc: Postgres hackers Subject: Re: Re-add recently-removed tests for ltree and intarray In-reply-to: References: Comments: In-reply-to Michael Paquier message dated "Fri, 15 May 2026 08:38:17 +0900" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <1140009.1778810969.1@sss.pgh.pa.us> Date: Thu, 14 May 2026 22:09:29 -0400 Message-ID: <1140010.1778810969@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Michael Paquier writes: > Some of you may have noticed that some regression tests have been > removed due to some noise in the buildfarm, as of commit 906ea101d0d5. > We did not have time to do something for this release, unfortunately. > It is possible to reproduce the incompatibility by setting > max_stack_depth to a low value, where the first new query of ltree and > intarray would fail, when written in their original shape. Just to add a little more color to this --- what we discovered after there was time for some investigation was that: (a) the stack-overflow failure occurred in the findoprnd() function of intarray/_int_bool.c or ltree/ltxtquery_io.c. (b) the failure only appeared on buildfarm members running on ppc64 or s390x. I determined by examining assembly code that ppc64 uses about 3X as much stack per call level in this function as x86_64; probably s390x is similar. That was enough to overrun our default max_stack_depth on these architectures, even though the same case passed on the machines we'd tested on. (c) even with minimum max_stack_depth, the test passed using gcc but not clang. Again examining assembly code, gcc is smart enough to collapse the tail-recursion calls in findoprnd() into looping, causing the original test case's right-deep query tree to consume essentially zero stack space. clang doesn't do that, at least not on those arches at default optimization level. You can make gcc fail too with -O0. So it'd be good to verify on a few oddball platforms that Michael's new attempt is OK. It should theoretically work, but ... regards, tom lane