Re: Re-add recently-removed tests for ltree and intarray

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Michael Paquier <michael(at)paquier(dot)xyz>
Cc: Postgres hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Re-add recently-removed tests for ltree and intarray
Date: 2026-05-15 02:09:29
Message-ID: 1140010.1778810969@sss.pgh.pa.us
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Michael Paquier <michael(at)paquier(dot)xyz> 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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message John Naylor 2026-05-15 02:47:04 Re: Re-add recently-removed tests for ltree and intarray
Previous Message Chao Li 2026-05-15 01:12:35 Fix bug of COPY (on_error set_null)