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

From: "Joel Jacobson" <joel(at)compiler(dot)org>
To: "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>, "Vik Fearing" <vik(at)postgresfriends(dot)org>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: [PATCH] Add error_on_null() to produce an error if the input is null
Date: 2025-08-31 08:04:02
Message-ID: 1b7b5490-5549-4447-82fe-432efc6f3f4a@app.fastmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Sat, Aug 30, 2025, at 18:38, Tom Lane wrote:
> Vik Fearing <vik(at)postgresfriends(dot)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

Attachment Content-Type Size
0001-Add-error_on_null-to-produce-an-error-if-the-input-i.patch application/octet-stream 4.7 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Mikael Kjellström 2025-08-31 08:19:53 Re: ecpg test thread/alloc hangs on sidewinder running NetBSD 9.3
Previous Message Jonathan S. Katz 2025-08-31 03:07:27 Re: PG 18 relnotes and RC1