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 1vd8tM-00ETMu-1S for pgsql-general@arkaria.postgresql.org; Tue, 06 Jan 2026 15:22:41 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1vd8tK-008f24-2M for pgsql-general@arkaria.postgresql.org; Tue, 06 Jan 2026 15:22:39 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1vd8tK-008f1w-14 for pgsql-general@lists.postgresql.org; Tue, 06 Jan 2026 15:22:39 +0000 Received: from mail-qk1-x72f.google.com ([2607:f8b0:4864:20::72f]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1vd8tI-004uqA-1t for pgsql-general@postgresql.org; Tue, 06 Jan 2026 15:22:38 +0000 Received: by mail-qk1-x72f.google.com with SMTP id af79cd13be357-8bb6a27d3edso91149885a.3 for ; Tue, 06 Jan 2026 07:22:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1767712955; x=1768317755; darn=postgresql.org; h=to:date:message-id:subject:mime-version:content-transfer-encoding :from:from:to:cc:subject:date:message-id:reply-to; bh=KI4YW1ZD0q7WSPZY3Ns2OG2wKykaS92/6x0JFcMwmUg=; b=Mj+eGgPM1rXwdmFhma8r955ptAXe09lqfLUSAo06HArlwkJFvao9mdZ7F7Ujmx6nNj saD1HBNpGSED6MPID3lcB2QzWblF0Xmpz8EznJMYUeKpXrb64shEecyeJQAuUjIjaRri iIDhguDdDzdF3F+sVrY3W16Md1doHVrpc5iiW9dGPGUJicZQJkfepyi0KWH2ot2opIL1 2TC/bjEiicgJ8CUC2D0zZSpCKtIvkCMW6KEL7VMPK0mXlb37DY+mVu8goSR2MNoJvesb HAi2J2+pNgBa4OqM3Ww7MjS24SSkFcZ5BHzFF9cz/uDoe20IDw0ucyjoxa+JArwW92el 2/2w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1767712955; x=1768317755; h=to:date:message-id:subject:mime-version:content-transfer-encoding :from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=KI4YW1ZD0q7WSPZY3Ns2OG2wKykaS92/6x0JFcMwmUg=; b=BHjny3mLjetU6nI7K3Ag0zZnjnSe4AATrGIJePuO8v/nQm61naktfhsmE/a2j1Driw ya/mNka9P8DAlnBI/YMtlKgzFBRF6zcnX5iz1qxqtZr+MdSMaPkhBY70WvujmUNhBFDM 3/Vqq0fqn281+Go5Epljx3bfkph/KyTI+oZFTQNuFqGlgreocvDluYMQxHb8+tYswLJB wtjOcJt4/t02HvW7+e3odRP4moFP6kjzz04Ja3g7OLCPftIMvBpRiC3bGZnf7Yvx5HeP vjukxKH0Zw1ut9kXV8IJ326QTbDxIAbO/zVlnIqg1DF4M9xN9KRLYwDtzCznBOKzIjjN lzAw== X-Gm-Message-State: AOJu0YwVPKnfgQFMaE+TPmqvvyTyNUFAGUM4My+nAGi0iugpxEmI75EB TgfaJuiucQPaxrWYZmP9EGpFsbPtNV36QZAJZJfaGfKfVl6pTdw+UccgAEtgYA== X-Gm-Gg: AY/fxX4VDEcAxH+gAuIcgTSu4ZeKZ7Qw0NGKaDkYBwFuqcJxvlxzP1JAOz+Jcuv16n8 hzZM0h/bQx87+FuyvV1RB/5vBwU+Pbb1BzcIbNv5LsD1zPQeQRHm1RugoRNd0Mjn+m42DD+ApvV A52ErPrSd6VkGPkjD/3sfaNjmzqGySqaBdap1NSw2uv/g/JjWanTgvNGSHc/pBkQwDZz6vhy/PQ xlW0orA53M8lFp5BxBXS7UmayGwXvHBdk2L/3LV5hm7Bw4KRZu+s1m3yq3b03l1inOPPtZIcw6m +kx6hwjXcRSvErvgfYJt8oRRA9YU5LiFmAPS4Jm8Iw3CyKAKPUqdbOo0KzwHYSzt+Bkk6FWygFR M9XILAPJVje0EO+AIf38nlvhNJC2d11oehKbCG75XRfE7agOrbTO0VGEMjHx6rR9iLgSNbUAVmd tuKt1qB21jAlUlqfVJh9xMTcfH9KzMx/HhxZtKvIZpVM0VnHG12IaaUOC0pPdoZe9AI2ZT8EB7x ko= X-Google-Smtp-Source: AGHT+IEv0cprKenP4tUGMMXQZfYp4p5Rw1x17ZB00jHm/b/7U9GPwmtBnT9UMtTv2pChf9GknwOLUQ== X-Received: by 2002:a05:620a:1a97:b0:8b2:dada:29b4 with SMTP id af79cd13be357-8c37ebde2a8mr460511485a.63.1767712954921; Tue, 06 Jan 2026 07:22:34 -0800 (PST) Received: from smtpclient.apple (dhcp-67-145-242-116.gobrightspeed.net. [67.145.242.116]) by smtp.gmail.com with ESMTPSA id af79cd13be357-8c37f51cf95sm184180585a.33.2026.01.06.07.22.34 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 06 Jan 2026 07:22:34 -0800 (PST) From: Eric Ridge Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3826.500.181.1.5\)) Subject: pg18 bug? SELECT query doesn't work Message-Id: <7900964C-F99E-481E-BEE5-4338774CEB9F@gmail.com> Date: Tue, 6 Jan 2026 10:22:23 -0500 To: pgsql-general X-Mailer: Apple Mail (2.3826.500.181.1.5) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Hi all! I ran into a situation where a query that worked just fine on pg15 fails = on pg18.1 with an ERROR. =20 I've compiled pg18.1 from source: # select version(); version = =20 = --------------------------------------------------------------------------= ----------------------------------------- PostgreSQL 18.1 on aarch64-apple-darwin24.4.0, compiled by Apple clang = version 17.0.0 (clang-1700.0.13.5), 64-bit (1 row) $ pg_config --configure '--prefix=3D/path/to/pg18' '--with-pgport=3D5418' '--enable-debug' = '--enable-cassert' 'CPPFLAGS=3D -DUSE_ASSERT_CHECKING=3D1 = -DRANDOMIZE_ALLOCATED_MEMORY=3D1 ' = 'PKG_CONFIG_PATH=3D/opt/homebrew/opt/icu4c/lib/pkgconfig' 'CFLAGS=3D-O0 = -g' 'CXXFLAGS=3D-I/opt/homebrew/include' Here's a reduced test case: 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 pg15 I get the expected result of: animal =20 -------- CATS (1 row) 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... With pg18 I messed around with rewriting it and discovered another = inconsistency: # with animals as ( select animal from (select upper(json_array_elements(json_data) ->> 'animal') animal, = count(*) from wth group by 1) x) select * from animals where animal ilike 'c%'; ERROR: set-valued function called in context that cannot accept a set LINE 3: from (select upper(json_array_elements(json_data) ->> 'anima... v/s # with animals as MATERIALIZED ( select animal from (select upper(json_array_elements(json_data) ->> 'animal') animal, = count(*) from wth group by 1) x) select * from animals where animal ilike 'c%'; animal =20 -------- CATS (1 row) I'd expect both those queries to return "CATS", in addition to the = original query that worked on (at least) pg15. Just thought I'd bring this to y'alls attention. Thanks and happy 2026! eric