On Mon, Nov 2, 2026 at 11:32 AM Fujii Masao <[email protected]> wrote:
> 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?
Codex found another case where the same query fails with enable_memoize
enabled but succeeds with it disabled. 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 CASE WHEN mi.k < 0
THEN mi.k = (SELECT 1 / (k - k) FROM mo LIMIT 1)
ELSE true END;
SET enable_memoize = on;
SELECT count(*)
FROM mo JOIN mi USING (k)
WHERE CASE WHEN mi.k < 0
THEN mi.k = (SELECT 1 / (k - k) FROM mo LIMIT 1)
ELSE true END;
--------------------------------------
Regards,
--
Fujii Masao