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 1vdBWE-00F1vb-1l for pgsql-general@arkaria.postgresql.org; Tue, 06 Jan 2026 18:10:59 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1vdBWD-009mHf-0d for pgsql-general@arkaria.postgresql.org; Tue, 06 Jan 2026 18:10:57 +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 1vdBWC-009mHW-2a for pgsql-general@lists.postgresql.org; Tue, 06 Jan 2026 18:10:57 +0000 Received: from mail-qv1-xf31.google.com ([2607:f8b0:4864:20::f31]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1vdBWA-004wCu-2f for pgsql-general@postgresql.org; Tue, 06 Jan 2026 18:10:57 +0000 Received: by mail-qv1-xf31.google.com with SMTP id 6a1803df08f44-88a3bba9fd4so11182226d6.2 for ; Tue, 06 Jan 2026 10:10:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1767723052; x=1768327852; 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=mP6rC0tdLuBHNJHQvTcTfmpQz4dVp3T2h68J0OESxHA=; b=QaTfGtt6B4bLPMh/WFPVMslavBxUlwQedkIX9z1aOlX71RJ2ciiGJTMQ1MeCDCIhWQ KbfBskRYUAqXgDeqKvJxh+1jIV1l5q4txEI0oumdIaOpiHcnQ6Fm2tqYm241r+ha31g+ U9MYtbvdntOMdqElcp6bOSNy4ALndcTlwsJy3qK3ZXFa+GbYg6IZAR4D8jg9d8YmaY60 jCYP1tHTR9tF42bDZI4377pdLtu5KFSInxXz0k4+fofHtIxDJjy8RhO2MAdJ5Ftcf/F/ lFJeVWgfLPcUIxb8y1hVvWY93jPFWzFm1w2FiV7TWzx9fZh9J9ukH2S/fgSAfXjV+exE pTKg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1767723052; x=1768327852; 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=mP6rC0tdLuBHNJHQvTcTfmpQz4dVp3T2h68J0OESxHA=; b=R2Y2tfRKHPZC1NTB21oM/7GOqvLlHnXmUXxbcPb6idth9WsC8Pq0lemXomLNwhK8JM D8D/hDZ95NnRLyYDFzK9WOIzvRFLSk7cLQh8NQpDoW9xoRn+dUd1uwv0BdjzqQ+pCn3Z MQt0F5oW0uFmXROj2Rivi2I5JNhOS4eMgAcURjiVn0VU/0x2QibOi9GjgmZ0cb0jMV03 iaL16vypAETV/EeBgwwV1CXEqn+JwueR4O4jumwAQXeF1fHwPVgYSYxuxDbQjXWGGXTK bk+8BpDLbJieXBkiibOrrKmcWbcEeqyJ/pUbRnbviEDqyoXQ9Y7JYBVcdg1iBEZRr4oi KZaA== X-Gm-Message-State: AOJu0Yzr0D8KePZi4e6NrlcKOa1m2dlGVXiENOi0blXWr+FvoFusI+j5 fIFcHkySjvI1r5yserJEBkeXPGsmyno7R2a+o4O3vduwHkDHXntF/WZl X-Gm-Gg: AY/fxX7V1tq9ZwwM6kO14yvXCJbxlMpGhzWD/iVWWEdslZFgnRa82FiVZgiBJw3mZNT Ej7Vu0tN74ECSKCDsSdC/Kz5a+q6Ui9XNMPI0/d2FxZ/6wo0dQo+ZmdTFLBdEibAQokYfeXox+M vpETXOancdn+5HgBMQ2TuL2pQCosHS/+IoTA4J8egsRLXXOigy4UUfa75UA795MY4XcsdAP9qnO KpyosIgoNs1SUZ56L0AW+rvOAbi+1XO7y7YR3/uTwKIGbqWrjpK3cHzm6Fzeu4v2EysI3r/l2ZP p8kHWwgtiEPZ4X4zGcjOaSFWPPYyhrVjYLbTKXjT4jzgEGk/K8GBArV7+R3sA7I+kFO2Q/TCU8+ ZVfGzZQxi5gRuTw8z8zbZySJcRSq/36Y6H76j9G+9aO2xJtMj0n4CYX8RNRW7f/+qyEacLPWM0B BpiFE46qDHZbPye+N8QOq6Xv/zq7+6WVuh8kvC1UEb+VGJEgUtZ8zEBMKmMAQQBK3Q X-Google-Smtp-Source: AGHT+IEfgcyp2oPNMYu5/FLk70ZattQ7dK1ufHUKee37l10yv6JkzHJgpT9hy8w30eN2fNahD1X2sA== X-Received: by 2002:ad4:5ccd:0:b0:88f:ca80:2b98 with SMTP id 6a1803df08f44-89075e463b4mr56844766d6.27.1767723051857; Tue, 06 Jan 2026 10:10:51 -0800 (PST) Received: from smtpclient.apple (dhcp-67-145-242-116.gobrightspeed.net. [67.145.242.116]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-890770ce298sm18017066d6.8.2026.01.06.10.10.51 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 06 Jan 2026 10:10:51 -0800 (PST) From: Eric Ridge Message-Id: <9A42D802-5994-4DAF-86FB-AB5954840216@gmail.com> Content-Type: multipart/alternative; boundary="Apple-Mail=_5413E18E-0E44-49FF-853B-02584D76291D" 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 13:10:40 -0500 In-Reply-To: Cc: pgsql-general To: "David G. Johnston" References: <7900964C-F99E-481E-BEE5-4338774CEB9F@gmail.com> <11E075EF-20F5-42CD-A014-16172FF05CCF@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=_5413E18E-0E44-49FF-853B-02584D76291D Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 > On Jan 6, 2026, at 12:00=E2=80=AFPM, David G. Johnston = wrote: >=20 > While I haven't dug into the actual specifics of this report in = detail, the change in question happened back in v10. >=20 > https://www.postgresql.org/docs/10/release-10.html Thanks. I wouldn't have thought to look back that far since the query = worked on v15. Interesting. > The failure to emit an error when it probably should have is likely a = bug in older versions since fixed. Fair enough. > That the behavior depends on the chosen plan and plans differ when you = do and do not materialize a CTE is likewise not surprising.=20 I guess I wouldn't expect Postgres to generate a plan that it then can't = execute. That's what's surprising to me. But it's fine. In all my years of using Postgres this is the first time = I've run into a query that no longer executes, so I wanted to bring it = to y'alls attention. Thanks again! eric= --Apple-Mail=_5413E18E-0E44-49FF-853B-02584D76291D Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=utf-8
On Jan 6, 2026, = at 12:00=E2=80=AFPM, David G. Johnston = <david.g.johnston@gmail.com> wrote:

While I haven't dug into the actual = specifics of this report in detail, the change in question happened back = in v10.


Thanks.  I wouldn't have thought to look back = that far since the query worked on v15. =  Interesting.

The failure to emit an error when it probably should have = is likely a bug in older versions since = fixed.

Fair = enough.

That the behavior = depends on the chosen plan and plans differ when you do and do not = materialize a CTE is likewise not surprising.  =

I guess I wouldn't = expect Postgres to generate a plan that it then can't execute. =  That's what's surprising to me.

But it's = fine.  In all my years of using Postgres this is the first time = I've run into a query that no longer executes, so I wanted to bring it = to y'alls attention.

Thanks = again!

eric
= --Apple-Mail=_5413E18E-0E44-49FF-853B-02584D76291D--