Re: BUG #17855: Uninitialised memory used when the name type value processed in binary mode of Memoize

From: Peter Geoghegan <pg(at)bowt(dot)ie>
To: David Rowley <dgrowleyml(at)gmail(dot)com>
Cc: exclusion(at)gmail(dot)com, pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: BUG #17855: Uninitialised memory used when the name type value processed in binary mode of Memoize
Date: 2023-03-23 04:27:19
Message-ID: CAH2-Wzn+=5z=Tscor-YK0sYDQg4QZWhLB-S0WgvwR5o=E0EDJg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Wed, Mar 22, 2023 at 9:01 PM David Rowley <dgrowleyml(at)gmail(dot)com> wrote:
> On Thu, 23 Mar 2023 at 16:25, Peter Geoghegan <pg(at)bowt(dot)ie> wrote:
> > Have you seen the comments about the cstring/name_ops hack mentioning
> > a SIGSEGV in btrescan()? Those were added around the time index-only
> > scans first went in.
>
> I'd not seen it. That's a bit disappointing. Is all this just to work
> around not having to store the full 64 bytes for a name in indexes?

Yes, that's the whole point of the hack.

> Seems it there are a few hacks that try to make this work. I wonder
> if we should just invent new hacks in the form of a new version of
> datum_image_eq that accepts a pointer to a FormData_pg_attribute
> instead of typByVal and typLen then just special case NAMEOID types to
> always compare as cstrings. Same for datum_image_hash().

The only reason why datum_image_eq() has support for cstring is B-Tree
deduplication; cstring support was added to allow nbtdedup.c to deal
with name/cstring indexes sensibly. So the fact that datum_image_eq()
can compare cstrings in the first place is in fact related to the same
general issue with name_ops.

--
Peter Geoghegan

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Tianyi Gao 2023-03-23 04:38:10 Re: operator class "xxx" does not exist for access method "yyy"
Previous Message David Rowley 2023-03-23 04:01:24 Re: BUG #17855: Uninitialised memory used when the name type value processed in binary mode of Memoize