[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: pgsql-hackers <pgsql-hackers@postgresql.org>
Date: 2025-08-30T11:49:48Z
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

Dear fellow hackers,

This polymorphic function produces an error if the input value is null,
otherwise it returns the input value unchanged.

This need for this function originates from the discussion
"Assert single row returning SQL-standard functions" [1].

/Joel

[1] https://www.postgresql.org/message-id/flat/9233b657-696f-430f-9557-dc602a2b9e0e%40app.fastmail.com