BUG #19409: Function jsonb_strip_nulls() changed from immutable to stable.
The Post Office <noreply@postgresql.org>
From: PG Bug reporting form <noreply@postgresql.org>
To: pgsql-bugs@lists.postgresql.org
Cc: lucio.chiessi@trustly.com
Date: 2026-02-13T19:51:03Z
Lists: pgsql-bugs
The following bug has been logged on the website:
Bug reference: 19409
Logged by: Lucio Chiessi
Email address: lucio.chiessi@trustly.com
PostgreSQL version: 18.1
Operating system: MacOS 15.7.3
Description:
Hello. We are using, in PostgreSQL 16, the function
jsonb_strip_nulls(jsonb) in a calculated table column, as shown below:
attributes_hash text generated always as
(md5(jsonb_strip_nulls(attributes)::text)) stored,
But using PostgreSQL 18 we having this error:
[ERROR] SQL State : 42P17
[ERROR] Error Code : 0
[ERROR] Message : ERROR: generation expression is not immutable
But this fails in PostgreSQL 18, because the jsonb_strip_nulls ( target
jsonb [,strip_in_arrays boolean ] ) function changed from immutable to
stable.
In PostgreSQL. I used the query below in both versions, with this change:
select proname,provolatile,pronargs,proparallel,proargnames
from pg_proc
where proname in ('jsonb_strip_nulls') and prokind = 'f';
In PostgreSQL 16.6, we have the value of 'provolatile' column as 'i', and in
PostgreSQL 18.1 as 's'.
I can't find any information about this change in the Release Notes v18.
Can we consider this a bug, or is this a normal behavior introduced in v18?
Thanks a lot.
Commits
-
Simplify creation of built-in functions with default arguments.
- 759b03b24ce9 19 (unreleased) landed
-
Fix the volatility setting of json{b}_strip_nulls
- 2f6ee7b389c2 18.3 landed