agora inbox for pgsql-committers@postgresql.orghelp / color / mirror / Atom feed
pgsql: Fix parsing of parenthesised OLD/NEW in RETURNING list. 2+ messages / 1 participants [nested] [flat]
* pgsql: Fix parsing of parenthesised OLD/NEW in RETURNING list. @ 2026-06-11 11:10 Dean Rasheed <dean.a.rasheed@gmail.com> 0 siblings, 0 replies; 2+ messages in thread From: Dean Rasheed @ 2026-06-11 11:10 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Fix parsing of parenthesised OLD/NEW in RETURNING list. When parsing expressions like (old).colname and (old).* in a RETURNING list, the parser would lose track of the intended varreturningtype, and therefore return incorrect results. The root cause was code using GetNSItemByRangeTablePosn() to find a namespace item from its rtindex and levelsup, without taking into account returningtype, which would return the wrong namespace item. Fix by adding a new function GetNSItemByVar() that does take returningtype into account. Backpatch to v18, where support for RETURNING OLD/NEW was added. Bug: #19516 Reported-by: Marko Grujic <markoog@gmail.com> Author: Marko Grujic <markoog@gmail.com> Suggested-by: Dean Rasheed <dean.a.rasheed@gmail.com> Reviewed-by: Dean Rasheed <dean.a.rasheed@gmail.com> Discussion: https://postgr.es/m/CAOvwyF2cO_5mAt=w=y-dFnaG5UkZ+3H8nSDoKF_iuWZHsU2ARg@mail.gmail.com Backpatch-through: 18 Branch ------ master Details ------- https://git.postgresql.org/pg/commitdiff/79c65b9d97fe92ea2792be09479cf4bbea7cefe1 Modified Files -------------- src/backend/parser/parse_coerce.c | 9 ++++----- src/backend/parser/parse_func.c | 4 +--- src/backend/parser/parse_relation.c | 32 ++++++++++++++++++++++++++++++++ src/backend/parser/parse_target.c | 2 +- src/include/parser/parse_relation.h | 1 + src/test/regress/expected/returning.out | 25 +++++++++++++++++++++++++ src/test/regress/sql/returning.sql | 11 +++++++++++ 7 files changed, 75 insertions(+), 9 deletions(-) ^ permalink raw reply [nested|flat] 2+ messages in thread
* pgsql: Fix parsing of parenthesised OLD/NEW in RETURNING list. @ 2026-06-11 11:10 Dean Rasheed <dean.a.rasheed@gmail.com> 0 siblings, 0 replies; 2+ messages in thread From: Dean Rasheed @ 2026-06-11 11:10 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Fix parsing of parenthesised OLD/NEW in RETURNING list. When parsing expressions like (old).colname and (old).* in a RETURNING list, the parser would lose track of the intended varreturningtype, and therefore return incorrect results. The root cause was code using GetNSItemByRangeTablePosn() to find a namespace item from its rtindex and levelsup, without taking into account returningtype, which would return the wrong namespace item. Fix by adding a new function GetNSItemByVar() that does take returningtype into account. Backpatch to v18, where support for RETURNING OLD/NEW was added. Bug: #19516 Reported-by: Marko Grujic <markoog@gmail.com> Author: Marko Grujic <markoog@gmail.com> Suggested-by: Dean Rasheed <dean.a.rasheed@gmail.com> Reviewed-by: Dean Rasheed <dean.a.rasheed@gmail.com> Discussion: https://postgr.es/m/CAOvwyF2cO_5mAt=w=y-dFnaG5UkZ+3H8nSDoKF_iuWZHsU2ARg@mail.gmail.com Backpatch-through: 18 Branch ------ REL_18_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/9108fed3eda97475d5ef2f9060f6bc1f61783346 Modified Files -------------- src/backend/parser/parse_coerce.c | 9 ++++----- src/backend/parser/parse_func.c | 4 +--- src/backend/parser/parse_relation.c | 32 ++++++++++++++++++++++++++++++++ src/backend/parser/parse_target.c | 2 +- src/include/parser/parse_relation.h | 1 + src/test/regress/expected/returning.out | 25 +++++++++++++++++++++++++ src/test/regress/sql/returning.sql | 11 +++++++++++ 7 files changed, 75 insertions(+), 9 deletions(-) ^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2026-06-11 11:10 UTC | newest] Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed) -- links below jump to the message on this page -- 2026-06-11 11:10 pgsql: Fix parsing of parenthesised OLD/NEW in RETURNING list. Dean Rasheed <dean.a.rasheed@gmail.com> 2026-06-11 11:10 pgsql: Fix parsing of parenthesised OLD/NEW in RETURNING list. Dean Rasheed <dean.a.rasheed@gmail.com>
This inbox is served by agora; see mirroring instructions for how to clone and mirror all data and code used for this inbox