Re: ERROR: XX000: could not find memoization table entry (reproducible)

From: David Rowley <dgrowleyml(at)gmail(dot)com>
To: "pgsql-bugs(at)lists(dot)postgresql(dot)org" <pgsql-bugs(at)lists(dot)postgresql(dot)org>
Cc: Emmanuel Touzery <emmanuel(dot)touzery(at)plandela(dot)si>
Subject: Re: ERROR: XX000: could not find memoization table entry (reproducible)
Date: 2025-10-22 21:04:55
Message-ID: CAApHDvpeEg2abJvNmHs9Lqtb_5QcC74j18S99fKvqGmjwzaPYg@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Thu, 23 Oct 2025 at 00:27, David Rowley <dgrowleyml(at)gmail(dot)com> wrote:
> v_tmp_loaddata = LLVMBuildZExt(b, v_tmp_loaddata, TypeDatum, "");

> Will look more tomorrow.

This seems to be a 1 liner fix. Basically, the zero extend should be a
signed extend. i.e, use LLVMBuildSExt().

Using [1] to get the extra debug output.

set jit_Above_Cost=0;
drop table if exists b;
create table b (a char, b smallint, c int);
insert into b values('-100'::char,-123,-1234);
insert into b values('123'::char,1234,12345);
set jit=1;
select * from b where c <> 0;
set jit=0;
select * from b where c <> 0;

With the patch, I get:

NOTICE: scan tuple = (a,b,c) (-,-123,-1234)
(124262785167352,18446744073709551493,18446744073709550382)
NOTICE: scan tuple = (a,b,c) (1,1234,12345) (124262785167320,1234,12345)
a | b | c
---+------+-------
- | -123 | -1234
1 | 1234 | 12345
(2 rows)

SET
NOTICE: scan tuple = (a,b,c) (-,-123,-1234)
(124262785167352,18446744073709551493,18446744073709550382)
NOTICE: scan tuple = (a,b,c) (1,1234,12345) (124262785167320,1234,12345)
a | b | c
---+------+-------
- | -123 | -1234
1 | 1234 | 12345
(2 rows)

And without, I get:

NOTICE: scan tuple = (a,b,c) (-,-123,-1234) (135890207272952,65413,4294966062)
NOTICE: scan tuple = (a,b,c) (1,1234,12345) (135890207272920,1234,12345)
a | b | c
---+------+-------
- | -123 | -1234
1 | 1234 | 12345
(2 rows)

SET
NOTICE: scan tuple = (a,b,c) (-,-123,-1234)
(135890207272952,18446744073709551493,18446744073709550382)
NOTICE: scan tuple = (a,b,c) (1,1234,12345) (135890207272920,1234,12345)
a | b | c
---+------+-------
- | -123 | -1234
1 | 1234 | 12345
(2 rows)

David

[1] https://www.postgresql.org/message-id/attachment/183414/debug_scan_data.diff

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message David Rowley 2025-10-22 21:13:57 Re: ERROR: XX000: could not find memoization table entry (reproducible)
Previous Message Markus KARG 2025-10-22 17:20:09 Re: Version 18.0 of postgres image in dockerhub - container crashes when starting up