1
0
mirror of https://github.com/postgres/postgres.git synced 2025-09-11 00:12:06 +03:00

Fix JsonExpr deparsing to quote variable names in the PASSING clause.

When deparsing a JsonExpr, variable names in the PASSING clause were
not quoted. However, since they are parsed as ColLabel tokens, some
variable names require double quotes to ensure that they are properly
interpreted. Fix by using quote_identifier() in the deparsing code.

This oversight was limited to the SQL/JSON query functions
JSON_EXISTS(), JSON_QUERY(), and JSON_VALUE().

Back-patch to v17, where these functions were added.

Dean Rasheed, reviewed by Tom Lane.

Discussion: https://postgr.es/m/CAEZATCXTpAS%3DncfLNTZ7YS6O5puHeLg_SUYAit%2Bcs7wsrd9Msg%40mail.gmail.com
This commit is contained in:
Dean Rasheed
2025-01-12 13:35:12 +00:00
parent d673eefd41
commit a93e2a1e25
3 changed files with 22 additions and 5 deletions

View File

@@ -10443,7 +10443,7 @@ get_rule_expr(Node *node, deparse_context *context,
get_rule_expr((Node *) lfirst(lc2), context, showimplicit);
appendStringInfo(buf, " AS %s",
((String *) lfirst_node(String, lc1))->sval);
quote_identifier(lfirst_node(String, lc1)->sval));
}
}