Treat JsonConstructorExpr as non-strict JsonConstructorExpr can produce non-NULL output with a NULL input, so it should be treated as a non-strict construct. Failing to do so can lead to incorrect query behavior.
For example, in the reported case, when pulling up a subquery that is under an outer join, if the subquery's target list contains a JsonConstructorExpr that uses subquery variables and it is mistakenly treated as strict, it will be pulled up without being wrapped in a PlaceHolderVar. As a result, the expression will be evaluated at the wrong place and will not be forced to null when the outer join should do so. Back-patch to v16 where JsonConstructorExpr was introduced. Bug: #19046 Reported-by: Runyuan He <[email protected]> Author: Tender Wang <[email protected]> Co-authored-by: Richard Guo <[email protected]> Discussion: https://postgr.es/m/[email protected] Backpatch-through: 16 Branch ------ REL_18_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/d29a3f4b46a043323dd5f39e9b97f1aaabbbec87 Modified Files -------------- src/backend/optimizer/util/clauses.c | 2 ++ src/test/regress/expected/subselect.out | 28 ++++++++++++++++++++++++++++ src/test/regress/sql/subselect.sql | 17 +++++++++++++++++ 3 files changed, 47 insertions(+)
