Re: Assert single row returning SQL-standard functions

From: "Joel Jacobson" <joel(at)compiler(dot)org>
To: "Pavel Stehule" <pavel(dot)stehule(at)gmail(dot)com>
Cc: "Vik Fearing" <vik(at)postgresfriends(dot)org>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Assert single row returning SQL-standard functions
Date: 2025-08-29 20:01:18
Message-ID: de94808d-ed58-4536-9e28-e79b09a534c7@app.fastmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, Aug 29, 2025, at 19:27, Pavel Stehule wrote:
> pá 29. 8. 2025 v 18:51 odesílatel Joel Jacobson <joel(at)compiler(dot)org> napsal:
>> In the meantime, maybe we want to add a catalog function
>> nonnull(anyelement) -> anyelement that throws an error if the input is
>> NULL? Seems like a function that could be useful in general.
>> Attached a small patch that adds such a function.
>
> +1

New version attached. Added docs and tests. Wasn't sure where to put the
docs. It's kinda a comparison function, since we compare against NULL
internally? I put the docs in func-comparison.sgml, please advise if
some other file would be better.

> Orafce introduces https://github.com/orafce/orafce:
>
> PLUnit
>
> <https://github.com/orafce/orafce#plunit>
> This unit contains some assert functions.

Nice, that looks like an impressive collection of lots of useful
functions, thanks, will check it out.

/Joel

Attachment Content-Type Size
0001-Add-nonnull-function-to-reject-null-values.patch application/octet-stream 4.2 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Yugo Nagata 2025-08-29 20:04:03 Re: Incremental View Maintenance, take 2
Previous Message Tom Lane 2025-08-29 19:46:33 Re: Adding some error context for lock wait failures