Re: BUG #19370: PG18 returns incorrect array slice results when slice bounds depend on another array expression

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

From: Tom Lane <tgl@sss.pgh.pa.us>
To: Andres Freund <andres@anarazel.de>
Cc: David Rowley <dgrowleyml@gmail.com>, redraiment@gmail.com, pgsql-bugs@lists.postgresql.org
Date: 2026-01-06T19:01:33Z
Lists: pgsql-bugs
I wrote:
> Andres Freund <andres@anarazel.de> writes:
>> At the very least we need to create a simplified testcase for the bug at hand.

> Yup, the sudoku example is fun but it seems inappropriate as a test
> case.

This seems simple enough:

regression=# with cte as
(select array[g,2] as a from generate_series(1,3) g)
select a[2], a[(select a[2])] from cte;
server closed the connection unexpectedly

			regards, tom lane



Commits

  1. Fix buggy interaction between array subscripts and subplan params