pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
pgsql: In deparsing, parenthesize IS DOCUMENT where it is an operand.
7+ messages / 1 participants
[nested] [flat]

* pgsql: In deparsing, parenthesize IS DOCUMENT where it is an operand.
@ 2026-10-20 18:29 Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 7+ messages in thread

From: Tom Lane @ 2026-10-20 18:29 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

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

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/b536d5a0bd7a0e35c3168f3022183f37cb5c2058

Modified Files
--------------
src/backend/utils/adt/ruleutils.c         | 33 ++++++++++++++++++++++++++-----
src/test/regress/expected/create_view.out | 21 +++++++++++++++++++-
src/test/regress/sql/create_view.sql      | 10 ++++++++++
3 files changed, 58 insertions(+), 6 deletions(-)



^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* pgsql: In deparsing, parenthesize IS DOCUMENT where it is an operand.
@ 2026-10-20 18:29 Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 7+ messages in thread

From: Tom Lane @ 2026-10-20 18:29 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

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

Branch
------
REL_19_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/cdc6c25f97fdbb50497eccfe5abdb4294025621e

Modified Files
--------------
src/backend/utils/adt/ruleutils.c         | 33 ++++++++++++++++++++++++++-----
src/test/regress/expected/create_view.out | 21 +++++++++++++++++++-
src/test/regress/sql/create_view.sql      | 10 ++++++++++
3 files changed, 58 insertions(+), 6 deletions(-)



^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* pgsql: In deparsing, parenthesize IS DOCUMENT where it is an operand.
@ 2026-10-20 18:29 Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 7+ messages in thread

From: Tom Lane @ 2026-10-20 18:29 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

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

Branch
------
REL_18_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/b08c4df3b733a77ae6404bee51ce0daa9d8a59cc

Modified Files
--------------
src/backend/utils/adt/ruleutils.c         | 33 ++++++++++++++++++++++++++-----
src/test/regress/expected/create_view.out | 21 +++++++++++++++++++-
src/test/regress/sql/create_view.sql      | 10 ++++++++++
3 files changed, 58 insertions(+), 6 deletions(-)



^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* pgsql: In deparsing, parenthesize IS DOCUMENT where it is an operand.
@ 2026-10-20 18:29 Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 7+ messages in thread

From: Tom Lane @ 2026-10-20 18:29 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

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

Branch
------
REL_17_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/467bb7ea7247d2657470bb8fba1d306d8cf7a57d

Modified Files
--------------
src/backend/utils/adt/ruleutils.c         | 33 ++++++++++++++++++++++++++-----
src/test/regress/expected/create_view.out | 21 +++++++++++++++++++-
src/test/regress/sql/create_view.sql      | 10 ++++++++++
3 files changed, 58 insertions(+), 6 deletions(-)



^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* pgsql: In deparsing, parenthesize IS DOCUMENT where it is an operand.
@ 2026-10-20 18:29 Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 7+ messages in thread

From: Tom Lane @ 2026-10-20 18:29 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

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

Branch
------
REL_16_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/715bf03057480fba9dc1905053f78bdc2b9f9cb8

Modified Files
--------------
src/backend/utils/adt/ruleutils.c         | 33 ++++++++++++++++++++++++++-----
src/test/regress/expected/create_view.out | 21 +++++++++++++++++++-
src/test/regress/sql/create_view.sql      | 10 ++++++++++
3 files changed, 58 insertions(+), 6 deletions(-)



^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* pgsql: In deparsing, parenthesize IS DOCUMENT where it is an operand.
@ 2026-10-20 18:29 Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 7+ messages in thread

From: Tom Lane @ 2026-10-20 18:29 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

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

Branch
------
REL_15_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/b104bcb408fac73b93dc5174914c906581f714df

Modified Files
--------------
src/backend/utils/adt/ruleutils.c         | 33 ++++++++++++++++++++++++++-----
src/test/regress/expected/create_view.out | 21 +++++++++++++++++++-
src/test/regress/sql/create_view.sql      | 10 ++++++++++
3 files changed, 58 insertions(+), 6 deletions(-)



^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* pgsql: In deparsing, parenthesize IS DOCUMENT where it is an operand.
@ 2026-10-20 18:29 Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 7+ messages in thread

From: Tom Lane @ 2026-10-20 18:29 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

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

Branch
------
REL_14_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/823474c041fb3f114fb73e1aef48654190ef2d6b

Modified Files
--------------
src/backend/utils/adt/ruleutils.c         | 33 ++++++++++++++++++++++++++-----
src/test/regress/expected/create_view.out | 21 +++++++++++++++++++-
src/test/regress/sql/create_view.sql      | 10 ++++++++++
3 files changed, 58 insertions(+), 6 deletions(-)



^ permalink  raw  reply  [nested|flat] 7+ messages in thread


end of thread, other threads:[~2026-10-20 18:29 UTC | newest]

Thread overview: 7+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2026-10-20 18:29 pgsql: In deparsing, parenthesize IS DOCUMENT where it is an operand. Tom Lane <tgl@sss.pgh.pa.us>
2026-10-20 18:29 pgsql: In deparsing, parenthesize IS DOCUMENT where it is an operand. Tom Lane <tgl@sss.pgh.pa.us>
2026-10-20 18:29 pgsql: In deparsing, parenthesize IS DOCUMENT where it is an operand. Tom Lane <tgl@sss.pgh.pa.us>
2026-10-20 18:29 pgsql: In deparsing, parenthesize IS DOCUMENT where it is an operand. Tom Lane <tgl@sss.pgh.pa.us>
2026-10-20 18:29 pgsql: In deparsing, parenthesize IS DOCUMENT where it is an operand. Tom Lane <tgl@sss.pgh.pa.us>
2026-10-20 18:29 pgsql: In deparsing, parenthesize IS DOCUMENT where it is an operand. Tom Lane <tgl@sss.pgh.pa.us>
2026-10-20 18:29 pgsql: In deparsing, parenthesize IS DOCUMENT where it is an operand. Tom Lane <tgl@sss.pgh.pa.us>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox