Re: Fix "could not find memoization table entry"

From: David Rowley <dgrowleyml(at)gmail(dot)com>
To: Tender Wang <tndrwang(at)gmail(dot)com>
Cc: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Fix "could not find memoization table entry"
Date: 2026-03-24 00:12:17
Message-ID: CAApHDvrSSeLNWzQWWcLfZKWwHd=XocVs3abmTmvaSD_sx-dkNQ@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, 23 Mar 2026 at 19:30, Tender Wang <tndrwang(at)gmail(dot)com> wrote:
> Recently, I encountered an error: could not find memoization table

> The hkeys returned by datum_image_hash() are different, so we can't
> find the entry in the hash table.
>
> In the datum_image_hash(), if typByVal is true, calling
> result = hash_bytes((unsigned char *) &value, sizeof(Datum));
>
> I think we should use typLen here, not sizeof(Datum).
> I tried this way and didn't encounter any errors again.

The Datum values should be the same. You can't just compare the lowest
attlen bytes of a Datum.

It looks to me like the bug is in hash_numeric(). Seems like it has no
idea what type it's meant to return. hash_numeric_extended() doesn't
seem to be much better.

Do you still get the ERROR after patching with the attached?

David

Attachment Content-Type Size
numeric.patch application/octet-stream 899 bytes

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Masahiko Sawada 2026-03-24 00:13:57 Re: [PATCH] Add max_logical_replication_slots GUC
Previous Message Masahiko Sawada 2026-03-23 23:36:07 Re: Introduce XID age based replication slot invalidation