Re: BUG #19409: Function jsonb_strip_nulls() changed from immutable to stable.

From: Andrew Dunstan <andrew(at)dunslane(dot)net>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, lucio(dot)chiessi(at)trustly(dot)com
Cc: pgsql-bugs(at)lists(dot)postgresql(dot)org, Florents Tselai <florents(dot)tselai(at)gmail(dot)com>
Subject: Re: BUG #19409: Function jsonb_strip_nulls() changed from immutable to stable.
Date: 2026-02-16 16:18:28
Message-ID: e531a86a-0c59-4028-96f8-2ac57028ebdb@dunslane.net
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-bugs


On 2026-02-13 Fr 3:18 PM, Tom Lane wrote:
> PG Bug reporting form<noreply(at)postgresql(dot)org> writes:
>> ... this fails in PostgreSQL 18, because the jsonb_strip_nulls ( target
>> jsonb [,strip_in_arrays boolean ] ) function changed from immutable to
>> stable.
> A bit of git excavation shows that this changed here:
>
> Author: Andrew Dunstan<andrew(at)dunslane(dot)net>
> Branch: master Release: REL_18_BR [4603903d2] 2025-03-05 10:04:02 -0500
>
> Allow json{b}_strip_nulls to remove null array elements
>
> An additional paramater ("strip_in_arrays") is added to these functions.
> It defaults to false. If true, then null array elements are removed as
> well as null valued object fields. JSON that just consists of a single
> null is not affected.
>
> Author: Florents Tselai<florents(dot)tselai(at)gmail(dot)com>
>
> Discussion:https://postgr.es/m/4BCECCD5-4F40-4313-9E98-9E16BEB0B01D@gmail.com
>
> It looks like a thinko to me, because surely the strip_in_arrays
> parameter did not make the function more mutable than before.
> Nor did a quick search find any discussion of the point in the
> thread.
>
>

Yeah. <paperbag>

In penance for this I have worked up a mechanism to generate
default-setting statements from pg_proc.dat that I will post separately
about in -hackers. In the meantime, I guess we should fix it in release
18 and master, with a release note that people might need to do a manual
update if affected, along the lines of

   update pg_proc set provolatile = 'i' where oid in (3261,3262);

cheers

andrew

--
Andrew Dunstan
EDB:https://www.enterprisedb.com

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2026-02-16 16:48:19 Re: BUG #19409: Function jsonb_strip_nulls() changed from immutable to stable.
Previous Message Heikki Linnakangas 2026-02-16 16:01:54 Re: 17.8 standby crashes during WAL replay from 17.5 primary: "could not access status of transaction"