pg.ddx.io pgsql-committers@postgresql.org mailing list archivehelp / color / mirror / Atom feed
pgsql: Fix postgres_fdw to check shippability of sort clauses properly. 6+ messages / 1 participants [nested] [flat]
* pgsql: Fix postgres_fdw to check shippability of sort clauses properly. @ 2022-03-31 18:30 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 6+ messages in thread From: Tom Lane @ 2022-03-31 18:30 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Fix postgres_fdw to check shippability of sort clauses properly. postgres_fdw would push ORDER BY clauses to the remote side without verifying that the sort operator is safe to ship. Moreover, it failed to print a suitable USING clause if the sort operator isn't default for the sort expression's type. The net result of this is that the remote sort might not have anywhere near the semantics we expect, which'd be disastrous for locally-performed merge joins in particular. We addressed similar issues in the context of ORDER BY within an aggregate function call in commit 7012b132d, but failed to notice that query-level ORDER BY was broken. Thus, much of the necessary logic already existed, but it requires refactoring to be usable in both cases. Back-patch to all supported branches. In HEAD only, remove the core code's copy of find_em_expr_for_rel, which is no longer used and really should never have been pushed into equivclass.c in the first place. Ronan Dunklau, per report from David Rowley; reviews by David Rowley, Ranier Vilela, and myself Discussion: https://postgr.es/m/CAApHDvr4OeC2DBVY--zVP83-K=bYrTD7F8SZDhN4g+pj2f2S-A@mail.gmail.com Branch ------ master Details ------- https://git.postgresql.org/pg/commitdiff/f3dd9fe1dd9254680591aa8d9891b90b8d735b2a Modified Files -------------- contrib/postgres_fdw/deparse.c | 166 ++++++++++++++++++------- contrib/postgres_fdw/expected/postgres_fdw.out | 23 ++++ contrib/postgres_fdw/postgres_fdw.c | 103 ++++++++++----- contrib/postgres_fdw/postgres_fdw.h | 13 +- contrib/postgres_fdw/sql/postgres_fdw.sql | 8 ++ src/backend/optimizer/path/equivclass.c | 29 ----- src/include/optimizer/paths.h | 1 - 7 files changed, 234 insertions(+), 109 deletions(-) ^ permalink raw reply [nested|flat] 6+ messages in thread
* pgsql: Fix postgres_fdw to check shippability of sort clauses properly. @ 2022-03-31 18:30 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 6+ messages in thread From: Tom Lane @ 2022-03-31 18:30 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Fix postgres_fdw to check shippability of sort clauses properly. postgres_fdw would push ORDER BY clauses to the remote side without verifying that the sort operator is safe to ship. Moreover, it failed to print a suitable USING clause if the sort operator isn't default for the sort expression's type. The net result of this is that the remote sort might not have anywhere near the semantics we expect, which'd be disastrous for locally-performed merge joins in particular. We addressed similar issues in the context of ORDER BY within an aggregate function call in commit 7012b132d, but failed to notice that query-level ORDER BY was broken. Thus, much of the necessary logic already existed, but it requires refactoring to be usable in both cases. Back-patch to all supported branches. In HEAD only, remove the core code's copy of find_em_expr_for_rel, which is no longer used and really should never have been pushed into equivclass.c in the first place. Ronan Dunklau, per report from David Rowley; reviews by David Rowley, Ranier Vilela, and myself Discussion: https://postgr.es/m/CAApHDvr4OeC2DBVY--zVP83-K=bYrTD7F8SZDhN4g+pj2f2S-A@mail.gmail.com Branch ------ REL_14_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/9f9489aa2eefeaf4a6517b0b14f8f22938c2e3f3 Modified Files -------------- contrib/postgres_fdw/deparse.c | 166 ++++++++++++++++++------- contrib/postgres_fdw/expected/postgres_fdw.out | 23 ++++ contrib/postgres_fdw/postgres_fdw.c | 103 ++++++++++----- contrib/postgres_fdw/postgres_fdw.h | 13 +- contrib/postgres_fdw/sql/postgres_fdw.sql | 8 ++ 5 files changed, 234 insertions(+), 79 deletions(-) ^ permalink raw reply [nested|flat] 6+ messages in thread
* pgsql: Fix postgres_fdw to check shippability of sort clauses properly. @ 2022-03-31 18:30 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 6+ messages in thread From: Tom Lane @ 2022-03-31 18:30 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Fix postgres_fdw to check shippability of sort clauses properly. postgres_fdw would push ORDER BY clauses to the remote side without verifying that the sort operator is safe to ship. Moreover, it failed to print a suitable USING clause if the sort operator isn't default for the sort expression's type. The net result of this is that the remote sort might not have anywhere near the semantics we expect, which'd be disastrous for locally-performed merge joins in particular. We addressed similar issues in the context of ORDER BY within an aggregate function call in commit 7012b132d, but failed to notice that query-level ORDER BY was broken. Thus, much of the necessary logic already existed, but it requires refactoring to be usable in both cases. Back-patch to all supported branches. In HEAD only, remove the core code's copy of find_em_expr_for_rel, which is no longer used and really should never have been pushed into equivclass.c in the first place. Ronan Dunklau, per report from David Rowley; reviews by David Rowley, Ranier Vilela, and myself Discussion: https://postgr.es/m/CAApHDvr4OeC2DBVY--zVP83-K=bYrTD7F8SZDhN4g+pj2f2S-A@mail.gmail.com Branch ------ REL_13_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/79df1d20c59c7fa21326f85be90f875fbe229ec6 Modified Files -------------- contrib/postgres_fdw/deparse.c | 166 ++++++++++++++++++------- contrib/postgres_fdw/expected/postgres_fdw.out | 23 ++++ contrib/postgres_fdw/postgres_fdw.c | 103 ++++++++++----- contrib/postgres_fdw/postgres_fdw.h | 13 +- contrib/postgres_fdw/sql/postgres_fdw.sql | 8 ++ 5 files changed, 234 insertions(+), 79 deletions(-) ^ permalink raw reply [nested|flat] 6+ messages in thread
* pgsql: Fix postgres_fdw to check shippability of sort clauses properly. @ 2022-03-31 18:30 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 6+ messages in thread From: Tom Lane @ 2022-03-31 18:30 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Fix postgres_fdw to check shippability of sort clauses properly. postgres_fdw would push ORDER BY clauses to the remote side without verifying that the sort operator is safe to ship. Moreover, it failed to print a suitable USING clause if the sort operator isn't default for the sort expression's type. The net result of this is that the remote sort might not have anywhere near the semantics we expect, which'd be disastrous for locally-performed merge joins in particular. We addressed similar issues in the context of ORDER BY within an aggregate function call in commit 7012b132d, but failed to notice that query-level ORDER BY was broken. Thus, much of the necessary logic already existed, but it requires refactoring to be usable in both cases. Back-patch to all supported branches. In HEAD only, remove the core code's copy of find_em_expr_for_rel, which is no longer used and really should never have been pushed into equivclass.c in the first place. Ronan Dunklau, per report from David Rowley; reviews by David Rowley, Ranier Vilela, and myself Discussion: https://postgr.es/m/CAApHDvr4OeC2DBVY--zVP83-K=bYrTD7F8SZDhN4g+pj2f2S-A@mail.gmail.com Branch ------ REL_12_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/989d3e4a2957d9ffbcc57414941b1946d4beece8 Modified Files -------------- contrib/postgres_fdw/deparse.c | 166 ++++++++++++++++++------- contrib/postgres_fdw/expected/postgres_fdw.out | 23 ++++ contrib/postgres_fdw/postgres_fdw.c | 108 +++++++++------- contrib/postgres_fdw/postgres_fdw.h | 13 +- contrib/postgres_fdw/sql/postgres_fdw.sql | 8 ++ 5 files changed, 222 insertions(+), 96 deletions(-) ^ permalink raw reply [nested|flat] 6+ messages in thread
* pgsql: Fix postgres_fdw to check shippability of sort clauses properly. @ 2022-03-31 18:30 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 6+ messages in thread From: Tom Lane @ 2022-03-31 18:30 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Fix postgres_fdw to check shippability of sort clauses properly. postgres_fdw would push ORDER BY clauses to the remote side without verifying that the sort operator is safe to ship. Moreover, it failed to print a suitable USING clause if the sort operator isn't default for the sort expression's type. The net result of this is that the remote sort might not have anywhere near the semantics we expect, which'd be disastrous for locally-performed merge joins in particular. We addressed similar issues in the context of ORDER BY within an aggregate function call in commit 7012b132d, but failed to notice that query-level ORDER BY was broken. Thus, much of the necessary logic already existed, but it requires refactoring to be usable in both cases. Back-patch to all supported branches. In HEAD only, remove the core code's copy of find_em_expr_for_rel, which is no longer used and really should never have been pushed into equivclass.c in the first place. Ronan Dunklau, per report from David Rowley; reviews by David Rowley, Ranier Vilela, and myself Discussion: https://postgr.es/m/CAApHDvr4OeC2DBVY--zVP83-K=bYrTD7F8SZDhN4g+pj2f2S-A@mail.gmail.com Branch ------ REL_11_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/b9eb0412ffb839e70e81820b6405db71d3f1966f Modified Files -------------- contrib/postgres_fdw/deparse.c | 158 ++++++++++++++++++------- contrib/postgres_fdw/expected/postgres_fdw.out | 23 ++++ contrib/postgres_fdw/postgres_fdw.c | 58 ++++----- contrib/postgres_fdw/postgres_fdw.h | 7 +- contrib/postgres_fdw/sql/postgres_fdw.sql | 8 ++ 5 files changed, 181 insertions(+), 73 deletions(-) ^ permalink raw reply [nested|flat] 6+ messages in thread
* pgsql: Fix postgres_fdw to check shippability of sort clauses properly. @ 2022-03-31 18:30 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 6+ messages in thread From: Tom Lane @ 2022-03-31 18:30 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Fix postgres_fdw to check shippability of sort clauses properly. postgres_fdw would push ORDER BY clauses to the remote side without verifying that the sort operator is safe to ship. Moreover, it failed to print a suitable USING clause if the sort operator isn't default for the sort expression's type. The net result of this is that the remote sort might not have anywhere near the semantics we expect, which'd be disastrous for locally-performed merge joins in particular. We addressed similar issues in the context of ORDER BY within an aggregate function call in commit 7012b132d, but failed to notice that query-level ORDER BY was broken. Thus, much of the necessary logic already existed, but it requires refactoring to be usable in both cases. Back-patch to all supported branches. In HEAD only, remove the core code's copy of find_em_expr_for_rel, which is no longer used and really should never have been pushed into equivclass.c in the first place. Ronan Dunklau, per report from David Rowley; reviews by David Rowley, Ranier Vilela, and myself Discussion: https://postgr.es/m/CAApHDvr4OeC2DBVY--zVP83-K=bYrTD7F8SZDhN4g+pj2f2S-A@mail.gmail.com Branch ------ REL_10_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/728fc0f9a2dd5f8b99be8cb6fc44171e4deb0490 Modified Files -------------- contrib/postgres_fdw/deparse.c | 158 ++++++++++++++++++------- contrib/postgres_fdw/expected/postgres_fdw.out | 23 ++++ contrib/postgres_fdw/postgres_fdw.c | 58 ++++----- contrib/postgres_fdw/postgres_fdw.h | 7 +- contrib/postgres_fdw/sql/postgres_fdw.sql | 8 ++ 5 files changed, 181 insertions(+), 73 deletions(-) ^ permalink raw reply [nested|flat] 6+ messages in thread
end of thread, other threads:[~2022-03-31 18:30 UTC | newest] Thread overview: 6+ messages (download: mbox mbox.gz follow: Atom feed) -- links below jump to the message on this page -- 2022-03-31 18:30 pgsql: Fix postgres_fdw to check shippability of sort clauses properly. Tom Lane <tgl@sss.pgh.pa.us> 2022-03-31 18:30 pgsql: Fix postgres_fdw to check shippability of sort clauses properly. Tom Lane <tgl@sss.pgh.pa.us> 2022-03-31 18:30 pgsql: Fix postgres_fdw to check shippability of sort clauses properly. Tom Lane <tgl@sss.pgh.pa.us> 2022-03-31 18:30 pgsql: Fix postgres_fdw to check shippability of sort clauses properly. Tom Lane <tgl@sss.pgh.pa.us> 2022-03-31 18:30 pgsql: Fix postgres_fdw to check shippability of sort clauses properly. Tom Lane <tgl@sss.pgh.pa.us> 2022-03-31 18:30 pgsql: Fix postgres_fdw to check shippability of sort clauses properly. 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