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 1vd9Y2-00Ebk0-2Z for pgsql-general@arkaria.postgresql.org; Tue, 06 Jan 2026 16:04:43 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1vd9Y0-008y88-1y for pgsql-general@arkaria.postgresql.org; Tue, 06 Jan 2026 16:04:41 +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 1vd9Y0-008y80-0q for pgsql-general@lists.postgresql.org; Tue, 06 Jan 2026 16:04:41 +0000 Received: from mail-oo1-xc2b.google.com ([2607:f8b0:4864:20::c2b]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1vd9Xz-004YcL-0Q for pgsql-general@postgresql.org; Tue, 06 Jan 2026 16:04:39 +0000 Received: by mail-oo1-xc2b.google.com with SMTP id 006d021491bc7-65b6b69baf8so361898eaf.3 for ; Tue, 06 Jan 2026 08:04:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1767715478; x=1768320278; darn=postgresql.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=0bi9U62cSlA7V/dEaMjxO5nqUFbbjNwzdyZd3bVjAas=; b=avd4AIMQZLehKFD5eFFC4hjwiou4XhmwCdPZtJFFZTJjY6sQVM6CVSC9WCvilIyx+b MFQd0Uf3jJiLOm8Z++X1SWekOlWKv2U05kAoQHH0dAVClyge5vV74tPtHmvTtMqGX4ZT 7OSHzzbxIM/Ifpd8bOcRKE/peKgFMwPnfZe+Usv/wazFySjcuuooSpZtOYVrSqQdru/w +gUf4wBTQM9AWiF6I8cwiOC1wthpUJS1b25tY3HGqvYsmGKrKAzfOFFALtV6qwI4Jm9F 1l2UV/Z1zNb3dLqSTZhDNXIQh2TUM9xWfFaKpOIuAysb1tCv6OfkcR6dLxK8rU9WneLY l0CQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1767715478; x=1768320278; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=0bi9U62cSlA7V/dEaMjxO5nqUFbbjNwzdyZd3bVjAas=; b=YccuCc4I8DECYxvrlVEwqlLN3MvGdTq+Od7mpq/iLuI/G2E1DcbgJ2SaSO5mkOhSc7 07HTuX7v9CfXs27NGQEjJAPEiETUJm/eudZYAuyeTGdTr3zhBx6p2NPmHbQwJ2XdwKsq nMlIqTUy16th/ld+3bv+p9Jcg0tnjCSz21YDrMn3oTIOhlqh7AC/g3tCDKxau08IucY/ rUPSo6FBpMCyND8xsSJYDjZrIa0rz4v9ng8JI0/Dolev+WLYhwZrT7tDVlvWABCF6eoF S6QGwKzT19xs3oldEbFpi3BvorsWbSCPz62ts6H3AhMjjrkQ1Qbn84mTVpPC7xL955tC 2nuw== X-Gm-Message-State: AOJu0YzhM/QFf0PDS77Lvh05wwAUdBO5JiU7+LdE0TO41s+PQqe+YuG7 DhfsdpCi/yQRzeaIJORXzR9i1iV1M7mSqoMuEGyict06KBRdnVoxAEJcAH9UIuixfgLLUiO2Ofq In6WeDpTUb8QzEH2nj7S0UrxgHW8XJMs= X-Gm-Gg: AY/fxX6i0aWvL5kzkkmHwt1U3uU0R9SVH8YXSfZrYLewpj4hVprjLwDKvecm3UjgqDj KtwKIKA9dKTY/tqDlxKJ4YSFRv0UiOntQpgYnc81tQlwfIganaOMKvcVLzAk+WBHVqM8WnJTb+L JcAmFHcC5rSpwBHtY3tn+1i0PgTKMgcejTJu9KbPDZd5K5ygm01wK1qpf/opKa7Dz56WASDoVX0 Hc2cTXnFbtL3G5suVS0MdpNtCBIrfYhFXO1fhXloabWdnP1ZwDy26IrWLuLJ377khJWnLeJ X-Google-Smtp-Source: AGHT+IGf15s8zPZwxCNte6ao/pi9gcrOQUYFb9RdlKCmLbcqtSJlTZEjZ2yg1tSHNDEeFPqxzSIUAytzGVTjMmPYNdg= X-Received: by 2002:a05:6820:2221:b0:65d:4d4:e7b0 with SMTP id 006d021491bc7-65f478be5d6mr2033400eaf.0.1767715478117; Tue, 06 Jan 2026 08:04:38 -0800 (PST) MIME-Version: 1.0 References: <7900964C-F99E-481E-BEE5-4338774CEB9F@gmail.com> In-Reply-To: <7900964C-F99E-481E-BEE5-4338774CEB9F@gmail.com> From: "David G. Johnston" Date: Tue, 6 Jan 2026 09:04:01 -0700 X-Gm-Features: AQt7F2oH3wngEulbWx0ExC16rBamSd0wv5MpxvjZOsHuG0TA6UDT_GIt0R9FOyM Message-ID: Subject: Re: pg18 bug? SELECT query doesn't work To: Eric Ridge Cc: pgsql-general Content-Type: multipart/alternative; boundary="0000000000002323450647ba5596" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --0000000000002323450647ba5596 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Tue, Jan 6, 2026 at 8:22=E2=80=AFAM Eric Ridge 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. --0000000000002323450647ba5596 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
On Tue, Jan 6, 2026 at 8:22=E2=80=AFAM Eric Ridge <eebbrr@gmail.com> wrote:
drop table if exists wth;
create table wth (id serial8, json_data json);
insert into wth (json_data) values ('[{"animal": "cats&q= uot;}, {"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:=C2=A0 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=C2=A0change.=C2=A0 You now should= be putting set-producing functions into the FROM clause of a query or subq= uery.=C2=A0 A lateral join is often required.

David J= .

--0000000000002323450647ba5596--