Re: [PATCH] Add error_on_null() to produce an error if the input is null

Joel Jacobson <joel@compiler.org>

From: "Joel Jacobson" <joel@compiler.org>
To: "Tom Lane" <tgl@sss.pgh.pa.us>, "Vik Fearing" <vik@postgresfriends.org>
Cc: pgsql-hackers <pgsql-hackers@postgresql.org>
Date: 2025-08-31T08:04:02Z
Lists: pgsql-hackers

Commits

Same data as JSON: GET /api/v1/messages/:b64id/commits the thread's linked commits as JSON, with link sources. API reference →
  1. Bump catalog version for new function error_on_null()

  2. Add error_on_null(), checking if the input is the null value

Attachments

On Sat, Aug 30, 2025, at 18:38, Tom Lane wrote:
> Vik Fearing <vik@postgresfriends.org> writes:
>> On 30/08/2025 13:49, Joel Jacobson wrote:
>>> This polymorphic function produces an error if the input value is null,
>>> otherwise it returns the input value unchanged.
>
>> This only checks for the null value.  I don't think we need to change 
>> the function's name, but we do need to be more precise in the 
>> documentation that it checks for the null value and not values that are 
>> null.
>
> Agreed.  You might be able to borrow some wording from the docs'
> discussion of the IS [NOT] NULL construct, and/or IS DISTINCT FROM.
>
> 			regards, tom lane

Thanks for great feedback. New patch attached.

/Joel