Re: Refactoring SysCacheGetAttr to know when attr cannot be NULL

Daniel Gustafsson <daniel@yesql.se>

From: Daniel Gustafsson <daniel@yesql.se>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Peter Eisentraut <peter.eisentraut@enterprisedb.com>, Postgres hackers <pgsql-hackers@lists.postgresql.org>
Date: 2023-03-01T20:34:11Z
Lists: pgsql-hackers
> On 1 Mar 2023, at 21:04, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> 
> Peter Eisentraut <peter.eisentraut@enterprisedb.com> writes:
>> Yes please!
> 
>> I have occasionally wondered whether just passing the isnull argument as 
>> NULL would be sufficient, so we don't need a new function.
> 
> I thought about that too.  I think I prefer Daniel's formulation
> with the new function, but I'm not especially set on that.

I prefer the new function since the name makes the code self documented rather
than developers not used to the API having to look up what the last NULL
actually means.

--
Daniel Gustafsson




Commits

  1. Add SysCacheGetAttrNotNull for guaranteed not-null attrs