1
0
mirror of https://github.com/postgres/postgres.git synced 2026-10-23 13:29:09 +03:00
Files
postgres/src/backend
Tom Lane 467bb7ea72 In deparsing, parenthesize IS DOCUMENT where it is an operand.
isSimpleNode() and related code treated every XmlExpr as
self-delimiting.  Most of them are, because they look like function
calls with some extra decoration.  But "x IS DOCUMENT" is not: it is
a postfix test, like IS NULL.  Printed as the operand of another
operator, or as the operand of a postfix test, it was therefore not
parenthesized and could not be parsed back, or was parsed as something
unintended.  Under-parenthesization occurred even in non-pretty-print
cases, so that this could break dump/restore workflows.

To fix, treat IS DOCUMENT as neither simple nor function-like, and
give it the same treatment as other postfix tests.

Also pass the single argument of IS DOCUMENT, not the argument list,
to get_rule_expr_paren().  This avoids unnecessary parenthesization
of the argument.

Author: Henson Choi <assam258@gmail.com>
Reviewed-by: Prashant Chinnam <crprashant@hotmail.com>
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://postgr.es/m/CAAAe_zDuPSkc8ihCctV67Lxbqock+S4wqCHHo8xxZ1t4teXo0g@mail.gmail.com
Backpatch-through: 14
2026-10-20 14:29:02 -04:00
..
2024-12-17 15:24:45 -06:00
2026-08-10 12:17:04 +02:00
2026-10-15 12:05:01 +03:00
2026-09-11 19:52:15 +02:00
2024-05-14 12:57:22 +02:00