public inbox for [email protected]  
help / color / mirror / Atom feed
From: David G. Johnston <[email protected]>
To: Eric Ridge <[email protected]>
Cc: pgsql-general <[email protected]>
Subject: Re: pg18 bug? SELECT query doesn't work
Date: Tue, 6 Jan 2026 09:04:01 -0700
Message-ID: <CAKFQuwbQj6kLxiz=Ft=ykM2s+H0ytCL7C+Cg1G=7W8ifhFi0Ow@mail.gmail.com> (raw)
In-Reply-To: <[email protected]>
References: <[email protected]>

On Tue, Jan 6, 2026 at 8:22 AM Eric Ridge <[email protected]> wrote:

> drop table if exists wth;
> create table wth (id serial8, json_data json);
> insert into wth (json_data) values ('[{"animal": "cats"}, {"animal":
> "dogs"}]');
>
> -- this ERRORs on pg18
> select animal
> from (select upper(json_array_elements(json_data) ->> 'animal') animal,
> count(*) from wth group by 1) x
> where animal ilike 'c%';
>
> On pg18 I'm presented with:
>
> ERROR:  set-valued function called in context that cannot accept a set
> LINE 1: select animal from (select upper(json_array_elements(json_da...
>
> Just thought I'd bring this to y'alls attention.
>
>
It was an intentional change.  You now should be putting set-producing
functions into the FROM clause of a query or subquery.  A lateral join is
often required.

David J.


reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected]
  Subject: Re: pg18 bug? SELECT query doesn't work
  In-Reply-To: <CAKFQuwbQj6kLxiz=Ft=ykM2s+H0ytCL7C+Cg1G=7W8ifhFi0Ow@mail.gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox