Re: bug: query returns different result with and without memoization.

From: Fujii Masao <masao(dot)fujii(at)gmail(dot)com>
To: Richard Guo <guofenglinux(at)gmail(dot)com>
Cc: Yilin Zhang <jiezhilove(at)126(dot)com>, David Rowley <dgrowleyml(at)gmail(dot)com>, Jacob Brazeal <jacob(dot)brazeal(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: bug: query returns different result with and without memoization.
Date: 2026-11-02 02:32:58
Message-ID: CAHGQGwHdaau1KooFbY10=MDhKtFVgpmPrDiwNpEe6bWu7wpQYA@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, Nov 2, 2026 at 10:46 AM Richard Guo <guofenglinux(at)gmail(dot)com> wrote:
> Pushed both and back-patched 0001 to v14.

Thanks for working on this!

Codex reported me that, after this change, the same query can fail with
enable_memoize enabled but succeed with it disabled, as shown below.
Is this a bug?

Here are the steps to reproduce it:

--------------------------------------
CREATE TEMP TABLE mo AS
SELECT g % 100 + 1 AS k FROM generate_series(1, 10000) g;

CREATE TEMP TABLE mi AS
SELECT g AS k FROM generate_series(1, 10000) g;

CREATE UNIQUE INDEX ON mi (k);
ANALYZE mo;
ANALYZE mi;

SET enable_memoize = off;

SELECT count(*)
FROM mo JOIN mi USING (k)
WHERE mi.k < ALL (VALUES (10001), (10002));

SET enable_memoize = on;

SELECT count(*)
FROM mo JOIN mi USING (k)
WHERE mi.k < ALL (VALUES (10001), (10002));
--------------------------------------

Regards,

--
Fujii Masao

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message mingjiegao 2026-11-02 02:36:56 Re: [PATCH] Fix incorrect logical replication updates with a shared leaf partition
Previous Message Chao Li 2026-11-02 02:05:21 Re: [PATCH] pgcrypto: Fix sha-crypt rounds= values that do not fit in int (BUG #19743)