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

From: David Rowley <dgrowleyml(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Alexander Lakhin <exclusion(at)gmail(dot)com>, Robert Haas <robertmhaas(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: 2024-05-01 01:30:23
Message-ID: CAApHDvrDo6-uavyTWa671uyxJtPFJ2JoKY7-TY7Q-vARhe3SzQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Wed, 1 May 2024 at 02:54, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> This version LGTM. The field names are fine, or at least I don't see
> a reason to prefer the other way. One trivial nit: should we make
> the array be AttrNumber* instead of int*? The space saving would be
> negligible (it being very unlikely that there's ever more than one
> entry), but AttrNumber is a more specific description of what it is.

I've pushed this after adjusting the int array to become an AttrNumber array.

I toyed with the idea of having the loop iterator in
ExecInitIndexOnlyScan() an AttrNumber type, but in the end went with a
cast. I felt this way was more robust against any possible future
widening of the AttrNumber typedef. I added the cast to prevent any
compilers from warning about truncation. This can't happen since
indnkeyatts is int16, but I don't know if all compilers would be able
to figure that out, so added a cast.

Thank you to both of you for reviewing this.

David

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message David Rowley 2024-05-01 02:34:34 Re: BUG #18451: NULL fails to coerce to string when performing string comparison
Previous Message Tom Lane 2024-05-01 00:31:19 Re: BUG #18453: --exclude-database has problems with capital letters