pgsql: Fix incorrect early exit from contain_mutable_functions_walker.

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Fix incorrect early exit from contain_mutable_functions_walker.
Date: 2026-11-11 22:45:08
Message-ID: E1xRH40-00000000Mgf-3YgL@gemulon.postgresql.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Fix incorrect early exit from contain_mutable_functions_walker.

Given a JsonExpr.path_spec that is a null constant,
contain_mutable_functions_walker immediately returned false, failing
to check for other sources of mutability elsewhere in the JsonExpr.
It must only skip the jspIsMutable() test in this case.

While here, remove a couple of redundant castNode calls (I'm not
a fan of using that directly after an explicit IsA check).

Bug: #19840
Reported-by: chunling qin <303677365(at)qq(dot)com>
Author: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Discussion: https://postgr.es/m/19840-7d5243be84d7ecd3@postgresql.org
Backpatch-through: 17

Branch
------
REL_17_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/69bccbbaef0a4868b409c07444ed10e1193c4d4a

Modified Files
--------------
src/backend/optimizer/util/clauses.c | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Fujii Masao 2026-11-12 00:25:40 pgsql: postgres_fdw: Fix possible crash after option initialization fai
Previous Message Masahiko Sawada 2026-11-11 18:38:48 pgsql: Fix the type of heap tuple count passed to parallel vacuum.