Re: pg18 bug? SELECT query doesn't work

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: Eric Ridge <eebbrr(at)gmail(dot)com>
Cc: pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: pg18 bug? SELECT query doesn't work
Date: 2026-01-06 16:04:01
Message-ID: CAKFQuwbQj6kLxiz=Ft=ykM2s+H0ytCL7C+Cg1G=7W8ifhFi0Ow@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-hackers

On Tue, Jan 6, 2026 at 8:22 AM Eric Ridge <eebbrr(at)gmail(dot)com> 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.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Eric Ridge 2026-01-06 16:16:08 Re: pg18 bug? SELECT query doesn't work
Previous Message Eric Ridge 2026-01-06 15:52:56 Re: pg18 bug? SELECT query doesn't work

Browse pgsql-hackers by date

  From Date Subject
Next Message Eric Ridge 2026-01-06 16:16:08 Re: pg18 bug? SELECT query doesn't work
Previous Message Xuneng Zhou 2026-01-06 15:58:18 Re: Implement waiting for wal lsn replay: reloaded