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 1vd9jN-00Edzi-1G for pgsql-general@arkaria.postgresql.org; Tue, 06 Jan 2026 16:16:26 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1vd9jM-00914E-0f for pgsql-general@arkaria.postgresql.org; Tue, 06 Jan 2026 16:16:24 +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 1vd9jL-009145-2l for pgsql-general@lists.postgresql.org; Tue, 06 Jan 2026 16:16:24 +0000 Received: from mail-qk1-x72c.google.com ([2607:f8b0:4864:20::72c]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1vd9jK-004vDx-05 for pgsql-general@postgresql.org; Tue, 06 Jan 2026 16:16:24 +0000 Received: by mail-qk1-x72c.google.com with SMTP id af79cd13be357-8b220ddc189so141775785a.0 for ; Tue, 06 Jan 2026 08:16:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1767716180; x=1768320980; darn=postgresql.org; h=references:to:cc:in-reply-to:date:subject:mime-version:message-id :from:from:to:cc:subject:date:message-id:reply-to; bh=FeNhUDnUUoK85L8E8xNsfnUhIOG/LijIy0qBTbCHpZs=; b=IT7CE4c6lmAU370BRNEkcDo/3R23hTbVdQRYOf6/Zzph17Aycwl5gy9pASQ/fmD9t2 5rfpEVU475RdTgS2hHX2rgNaItFiByOEbzrPp9UngO5/T1b1EkYzzBIrONlyCt3yXPXK gTfWG94VPn5lRO/wruoSpTJ+OEsBye1lP3asBq+171i+XPL4hOOW913bSUV/9gs1v0eV ek7LjkSufTVQBfb8C1zok6lu1G0wKgHxHBT/wYih6AqcEq6qOhFjFEzYNj5NET4LX8kG +fRy4mHfUgE1ldnpCPqaOlJEDKp1c1oumreA/Pik9DZwZWtSFZC3eiyOPsm9uMsYoNjH XcQg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1767716180; x=1768320980; h=references:to:cc:in-reply-to:date:subject:mime-version:message-id :from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=FeNhUDnUUoK85L8E8xNsfnUhIOG/LijIy0qBTbCHpZs=; b=Y3mzvTg4Yvbnm49Ok7LsNqBvJrFq38jA9pUe5YbH5W1W07086/f80VJYQxhi11fJCD zDAQdYzYUQWx91m3/JoN6qcRmPv1jYRAw3S5ZKzn0EPxk2p25rsCUHsM97UzuB2+h2aT //9dfIJEKtDsOkh3N77mlQCqb//NVtKp9vpphQ5M91a1gSl7WsVlAvvClUvl+tGbwe3G 9IhD6rMvLmCxlemv9eboXhd2nLuI+xlAAijlp4EQQxvx8HYtcuNGD9VNKRzSup7kM+Zq mPvAqFg+WIx8FcGJMHmtdCPiUyOHpyQJFdhAfVR6YBRKmZvg4YnWmD/yc2DXewa0Cxfd qvdw== X-Gm-Message-State: AOJu0Yy9K/ugfIBluZtN/7MH8xb8w3JiFcKkZN4QdeWHSkcqCt5WHq6l uoJY9M0sEYv+66UG/ey88HkUPu2C3ywayKLftwBWFtjpJkdLRPpirX1FvL/OEQ== X-Gm-Gg: AY/fxX7HXa5/+D7snTKVrYafCi27Ny1zmiLA4pbxY/zphoIpOR7AbD7L461e0QCnMx4 0xjSOZmLMHHXqPx6noZ/Fsl5R6o+vW6H5OXWSQDmf/lHzLaqV7ypZNZSwwpfjn+GwWs57sMUpKO KDntM1RO/0bSebQ5R76GNMdLchNJ6pFEiyW7l028w9SDouPFdMG1DNNtdk43fCKbVCrTb5etXtU XTrNqZ6qfZPSI8G4dsd2BGMEu/x+3GKiDiuFaDML7W2CM/0EL+Qa9cMSxA14e37ML1NBY3ZL5yl C9Uj2fW20/yK2is8i3CFik7Y19qLs7qU9wsqvYGozhMuMJ4l8ynYIaFN1811BoaV0YLiKgkHqK6 HiFGfNvXESGPl44dOLVURCiqizKV409/GHDW1f/FkGfMb4F5WzyjM9yLINJAshAJYG8gjd2Sdzw 5E8hpxeI1H5bRtB1/HuziI20dWjGwHwY69dZ3xvrYt878SIetP1hbZ8YnGD0hG0PkT X-Google-Smtp-Source: AGHT+IHw5PFxAWrEaUVGfbwxdnOyUaDvlxdYtIZK6HeIFDXJbitn33LgPwvyPvX2wUI8plt9bAuESA== X-Received: by 2002:a05:620a:371a:b0:8c0:f6a9:b4e7 with SMTP id af79cd13be357-8c37eb9833dmr544595685a.38.1767716180059; Tue, 06 Jan 2026 08:16:20 -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-8c37f546839sm197592285a.51.2026.01.06.08.16.19 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 06 Jan 2026 08:16:19 -0800 (PST) From: Eric Ridge Message-Id: <11E075EF-20F5-42CD-A014-16172FF05CCF@gmail.com> Content-Type: multipart/alternative; boundary="Apple-Mail=_AFE8688D-CD12-4108-8E0B-EB7E2EDF9C9C" Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3826.500.181.1.5\)) Subject: Re: pg18 bug? SELECT query doesn't work Date: Tue, 6 Jan 2026 11:16:08 -0500 In-Reply-To: Cc: pgsql-general To: "David G. Johnston" References: <7900964C-F99E-481E-BEE5-4338774CEB9F@gmail.com> 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 --Apple-Mail=_AFE8688D-CD12-4108-8E0B-EB7E2EDF9C9C Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 > On Jan 6, 2026, at 11:04=E2=80=AFAM, David G. Johnston = wrote: >=20 >=20 > 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. I'm willing to accept that, but I can't find this called out in the = release notes between 15 and 18.1. I could have overlooked it, of = course. It is very surprising to me that Postgres would intentionally break = previously-working SELECT statements and that the CTE version is = inconsistent between "AS MATERIALIZED". The WITH MATERIALIZED docs = don't mention anything about certain query shapes being incompatible. eric --Apple-Mail=_AFE8688D-CD12-4108-8E0B-EB7E2EDF9C9C Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=utf-8
On Jan 6, 2026, = at 11:04=E2=80=AFAM, David G. Johnston = <david.g.johnston@gmail.com> wrote:


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.

I'm willing = to accept that, but I can't find this called out in the release notes = between 15 and 18.1.  I could have overlooked it, of = course.

It is very surprising to me that = Postgres would intentionally break previously-working SELECT statements = and that the CTE version is inconsistent between "AS MATERIALIZED". =  The WITH MATERIALIZED docs don't mention anything about certain = query shapes being = incompatible.

eric


= --Apple-Mail=_AFE8688D-CD12-4108-8E0B-EB7E2EDF9C9C--