Re: Fix "could not find memoization table entry" - Mailing list pgsql-hackers

From Tender Wang
Subject Re: Fix "could not find memoization table entry"
Date
Msg-id CAHewXNkO0NO4+98=E=QodAUz_mkX2YOB0rD_C3Yz7o383aRhVQ@mail.gmail.com
Whole thread
In response to Re: Fix "could not find memoization table entry"  (David Rowley <dgrowleyml@gmail.com>)
Responses Re: Fix "could not find memoization table entry"
List pgsql-hackers
David Rowley <dgrowleyml@gmail.com> 于2026年3月24日周二 08:12写道:
>
> On Mon, 23 Mar 2026 at 19:30, Tender Wang <tndrwang@gmail.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.

Thanks for pointing this out.
Actually, I haven't quite figured out why `typLen` cannot be used here.

>
> 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?

No error anymore with your patch.


--
Thanks,
Tender Wang



pgsql-hackers by date:

Previous
From: Henson Choi
Date:
Subject: Re: SQL Property Graph Queries (SQL/PGQ)
Next
From: jian he
Date:
Subject: Re: [PATCH] no table rewrite when set column type to constrained domain