pg.ddx.io pgsql-committers@postgresql.org mailing list archivehelp / color / mirror / Atom feed
pgsql: Fix JSON_TABLE with sublinks in PASSING arguments 4+ messages / 1 participants [nested] [flat]
* pgsql: Fix JSON_TABLE with sublinks in PASSING arguments @ 2026-10-29 01:39 Amit Langote <amitlan@postgresql.org> 0 siblings, 0 replies; 4+ messages in thread From: Amit Langote @ 2026-10-29 01:39 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Fix JSON_TABLE with sublinks in PASSING arguments transformJsonTable() handed the raw PASSING argument list both to the JsonFuncExpr built for the row pattern and, via transformJsonTableColumn(), to the JsonFuncExpr built for each column other than FOR ORDINALITY, so the same raw expressions were run through transformExpr() once for the row pattern and again for every such column. That doesn't work for sublinks: transformSubLink() replaces the SubLink's raw subselect with the analyzed Query, so the second pass failed with "unexpected non-SELECT command in SubLink". Other nodes that are transformed in place, such as NullTest, failed with "unrecognized node type". Any such PASSING argument therefore made JSON_TABLE fail unless all of its columns were FOR ORDINALITY. Fix by giving each transformation its own copy of the raw PASSING arguments. Bug: #19786 Reported-by: Alperen Keles <alpkeles99@gmail.com> Author: Ayush Tiwari <ayushtiwari.slg01@gmail.com> Co-authored-by: Amit Langote <amitlangote09@gmail.com> Discussion: https://postgr.es/m/19786-70758103a4b2bff2@postgresql.org Backpatch-through: 17 Branch ------ REL_17_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/8793978e30accc730b31f6557afb2c8469e48250 Modified Files -------------- src/backend/parser/parse_jsontable.c | 11 +++- src/test/regress/expected/sqljson_jsontable.out | 80 +++++++++++++++++++++++++ src/test/regress/sql/sqljson_jsontable.sql | 49 +++++++++++++++ 3 files changed, 138 insertions(+), 2 deletions(-) ^ permalink raw reply [nested|flat] 4+ messages in thread
* pgsql: Fix JSON_TABLE with sublinks in PASSING arguments @ 2026-10-29 01:39 Amit Langote <amitlan@postgresql.org> 0 siblings, 0 replies; 4+ messages in thread From: Amit Langote @ 2026-10-29 01:39 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Fix JSON_TABLE with sublinks in PASSING arguments transformJsonTable() handed the raw PASSING argument list both to the JsonFuncExpr built for the row pattern and, via transformJsonTableColumn(), to the JsonFuncExpr built for each column other than FOR ORDINALITY, so the same raw expressions were run through transformExpr() once for the row pattern and again for every such column. That doesn't work for sublinks: transformSubLink() replaces the SubLink's raw subselect with the analyzed Query, so the second pass failed with "unexpected non-SELECT command in SubLink". Other nodes that are transformed in place, such as NullTest, failed with "unrecognized node type". Any such PASSING argument therefore made JSON_TABLE fail unless all of its columns were FOR ORDINALITY. Fix by giving each transformation its own copy of the raw PASSING arguments. Bug: #19786 Reported-by: Alperen Keles <alpkeles99@gmail.com> Author: Ayush Tiwari <ayushtiwari.slg01@gmail.com> Co-authored-by: Amit Langote <amitlangote09@gmail.com> Discussion: https://postgr.es/m/19786-70758103a4b2bff2@postgresql.org Backpatch-through: 17 Branch ------ REL_18_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/6cb715e2d6a1108977e4a12ae5e9831217793e55 Modified Files -------------- src/backend/parser/parse_jsontable.c | 11 +++- src/test/regress/expected/sqljson_jsontable.out | 80 +++++++++++++++++++++++++ src/test/regress/sql/sqljson_jsontable.sql | 49 +++++++++++++++ 3 files changed, 138 insertions(+), 2 deletions(-) ^ permalink raw reply [nested|flat] 4+ messages in thread
* pgsql: Fix JSON_TABLE with sublinks in PASSING arguments @ 2026-10-29 01:39 Amit Langote <amitlan@postgresql.org> 0 siblings, 0 replies; 4+ messages in thread From: Amit Langote @ 2026-10-29 01:39 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Fix JSON_TABLE with sublinks in PASSING arguments transformJsonTable() handed the raw PASSING argument list both to the JsonFuncExpr built for the row pattern and, via transformJsonTableColumn(), to the JsonFuncExpr built for each column other than FOR ORDINALITY, so the same raw expressions were run through transformExpr() once for the row pattern and again for every such column. That doesn't work for sublinks: transformSubLink() replaces the SubLink's raw subselect with the analyzed Query, so the second pass failed with "unexpected non-SELECT command in SubLink". Other nodes that are transformed in place, such as NullTest, failed with "unrecognized node type". Any such PASSING argument therefore made JSON_TABLE fail unless all of its columns were FOR ORDINALITY. Fix by giving each transformation its own copy of the raw PASSING arguments. Bug: #19786 Reported-by: Alperen Keles <alpkeles99@gmail.com> Author: Ayush Tiwari <ayushtiwari.slg01@gmail.com> Co-authored-by: Amit Langote <amitlangote09@gmail.com> Discussion: https://postgr.es/m/19786-70758103a4b2bff2@postgresql.org Backpatch-through: 17 Branch ------ REL_19_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/1ecc3cee7824e607cc3b59c2dd8043c03b90126d Modified Files -------------- src/backend/parser/parse_jsontable.c | 11 +++- src/test/regress/expected/sqljson_jsontable.out | 80 +++++++++++++++++++++++++ src/test/regress/sql/sqljson_jsontable.sql | 49 +++++++++++++++ 3 files changed, 138 insertions(+), 2 deletions(-) ^ permalink raw reply [nested|flat] 4+ messages in thread
* pgsql: Fix JSON_TABLE with sublinks in PASSING arguments @ 2026-10-29 01:39 Amit Langote <amitlan@postgresql.org> 0 siblings, 0 replies; 4+ messages in thread From: Amit Langote @ 2026-10-29 01:39 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Fix JSON_TABLE with sublinks in PASSING arguments transformJsonTable() handed the raw PASSING argument list both to the JsonFuncExpr built for the row pattern and, via transformJsonTableColumn(), to the JsonFuncExpr built for each column other than FOR ORDINALITY, so the same raw expressions were run through transformExpr() once for the row pattern and again for every such column. That doesn't work for sublinks: transformSubLink() replaces the SubLink's raw subselect with the analyzed Query, so the second pass failed with "unexpected non-SELECT command in SubLink". Other nodes that are transformed in place, such as NullTest, failed with "unrecognized node type". Any such PASSING argument therefore made JSON_TABLE fail unless all of its columns were FOR ORDINALITY. Fix by giving each transformation its own copy of the raw PASSING arguments. Bug: #19786 Reported-by: Alperen Keles <alpkeles99@gmail.com> Author: Ayush Tiwari <ayushtiwari.slg01@gmail.com> Co-authored-by: Amit Langote <amitlangote09@gmail.com> Discussion: https://postgr.es/m/19786-70758103a4b2bff2@postgresql.org Backpatch-through: 17 Branch ------ master Details ------- https://git.postgresql.org/pg/commitdiff/35b349a530c61628f4b7a7968212e594297523c6 Modified Files -------------- src/backend/parser/parse_jsontable.c | 11 +++- src/test/regress/expected/sqljson_jsontable.out | 80 +++++++++++++++++++++++++ src/test/regress/sql/sqljson_jsontable.sql | 49 +++++++++++++++ 3 files changed, 138 insertions(+), 2 deletions(-) ^ permalink raw reply [nested|flat] 4+ messages in thread
end of thread, other threads:[~2026-10-29 01:39 UTC | newest] Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed) -- links below jump to the message on this page -- 2026-10-29 01:39 pgsql: Fix JSON_TABLE with sublinks in PASSING arguments Amit Langote <amitlan@postgresql.org> 2026-10-29 01:39 pgsql: Fix JSON_TABLE with sublinks in PASSING arguments Amit Langote <amitlan@postgresql.org> 2026-10-29 01:39 pgsql: Fix JSON_TABLE with sublinks in PASSING arguments Amit Langote <amitlan@postgresql.org> 2026-10-29 01:39 pgsql: Fix JSON_TABLE with sublinks in PASSING arguments Amit Langote <amitlan@postgresql.org>
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