pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
pgsql: Disallow replacing joins with scans in problematic cases.
7+ messages / 1 participants
[nested] [flat]

* pgsql: Disallow replacing joins with scans in problematic cases.
@ 2023-07-28 06:51  Etsuro Fujita <efujita@postgresql.org>
  0 siblings, 0 replies; 7+ messages in thread

From: Etsuro Fujita @ 2023-07-28 06:51 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Disallow replacing joins with scans in problematic cases.

Commit e7cb7ee14, which introduced the infrastructure for FDWs and
custom scan providers to replace joins with scans, failed to add support
handling of pseudoconstant quals assigned to replaced joins in
createplan.c, leading to an incorrect plan without a gating Result node
when postgres_fdw replaced a join with such a qual.

To fix, we could add the support by 1) modifying the ForeignPath and
CustomPath structs to store the list of RestrictInfo nodes to apply to
the join, as in JoinPaths, if they represent foreign and custom scans
replacing a join with a scan, and by 2) modifying create_scan_plan() in
createplan.c to use that list in that case, instead of the
baserestrictinfo list, to get pseudoconstant quals assigned to the join;
but #1 would cause an ABI break.  So fix by modifying the infrastructure
to just disallow replacing joins with such quals.

Back-patch to all supported branches.

Reported by Nishant Sharma.  Patch by me, reviewed by Nishant Sharma and
Richard Guo.

Discussion: https://postgr.es/m/CADrsxdbcN1vejBaf8a%2BQhrZY5PXL-04mCd4GDu6qm6FigDZd6Q%40mail.gmail.com

Branch
------
REL_11_STABLE

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

Modified Files
--------------
contrib/postgres_fdw/expected/postgres_fdw.out | 26 +++++++++++++++++++++++
contrib/postgres_fdw/sql/postgres_fdw.sql      |  3 +++
src/backend/optimizer/path/joinpath.c          | 19 +++++++++++++++--
src/backend/optimizer/util/restrictinfo.c      | 29 ++++++++++++++++++++++++++
src/include/optimizer/restrictinfo.h           |  2 ++
5 files changed, 77 insertions(+), 2 deletions(-)



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

* pgsql: Disallow replacing joins with scans in problematic cases.
@ 2023-07-28 06:51  Etsuro Fujita <efujita@postgresql.org>
  0 siblings, 0 replies; 7+ messages in thread

From: Etsuro Fujita @ 2023-07-28 06:51 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Disallow replacing joins with scans in problematic cases.

Commit e7cb7ee14, which introduced the infrastructure for FDWs and
custom scan providers to replace joins with scans, failed to add support
handling of pseudoconstant quals assigned to replaced joins in
createplan.c, leading to an incorrect plan without a gating Result node
when postgres_fdw replaced a join with such a qual.

To fix, we could add the support by 1) modifying the ForeignPath and
CustomPath structs to store the list of RestrictInfo nodes to apply to
the join, as in JoinPaths, if they represent foreign and custom scans
replacing a join with a scan, and by 2) modifying create_scan_plan() in
createplan.c to use that list in that case, instead of the
baserestrictinfo list, to get pseudoconstant quals assigned to the join;
but #1 would cause an ABI break.  So fix by modifying the infrastructure
to just disallow replacing joins with such quals.

Back-patch to all supported branches.

Reported by Nishant Sharma.  Patch by me, reviewed by Nishant Sharma and
Richard Guo.

Discussion: https://postgr.es/m/CADrsxdbcN1vejBaf8a%2BQhrZY5PXL-04mCd4GDu6qm6FigDZd6Q%40mail.gmail.com

Branch
------
REL_13_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/730f983effa51f578e85db27a5b4b906725ecd7a

Modified Files
--------------
contrib/postgres_fdw/expected/postgres_fdw.out | 26 +++++++++++++++++++++++
contrib/postgres_fdw/sql/postgres_fdw.sql      |  3 +++
src/backend/optimizer/path/joinpath.c          | 19 +++++++++++++++--
src/backend/optimizer/util/restrictinfo.c      | 29 ++++++++++++++++++++++++++
src/include/optimizer/restrictinfo.h           |  2 ++
5 files changed, 77 insertions(+), 2 deletions(-)



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

* pgsql: Disallow replacing joins with scans in problematic cases.
@ 2023-07-28 06:51  Etsuro Fujita <efujita@postgresql.org>
  0 siblings, 0 replies; 7+ messages in thread

From: Etsuro Fujita @ 2023-07-28 06:51 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Disallow replacing joins with scans in problematic cases.

Commit e7cb7ee14, which introduced the infrastructure for FDWs and
custom scan providers to replace joins with scans, failed to add support
handling of pseudoconstant quals assigned to replaced joins in
createplan.c, leading to an incorrect plan without a gating Result node
when postgres_fdw replaced a join with such a qual.

To fix, we could add the support by 1) modifying the ForeignPath and
CustomPath structs to store the list of RestrictInfo nodes to apply to
the join, as in JoinPaths, if they represent foreign and custom scans
replacing a join with a scan, and by 2) modifying create_scan_plan() in
createplan.c to use that list in that case, instead of the
baserestrictinfo list, to get pseudoconstant quals assigned to the join;
but #1 would cause an ABI break.  So fix by modifying the infrastructure
to just disallow replacing joins with such quals.

Back-patch to all supported branches.

Reported by Nishant Sharma.  Patch by me, reviewed by Nishant Sharma and
Richard Guo.

Discussion: https://postgr.es/m/CADrsxdbcN1vejBaf8a%2BQhrZY5PXL-04mCd4GDu6qm6FigDZd6Q%40mail.gmail.com

Branch
------
REL_16_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/695f5deb7902865901eb2d50a70523af655c3a00

Modified Files
--------------
contrib/postgres_fdw/expected/postgres_fdw.out | 26 ++++++++++++++++++++++
contrib/postgres_fdw/sql/postgres_fdw.sql      |  3 +++
src/backend/optimizer/path/joinpath.c          | 19 ++++++++++++++--
src/backend/optimizer/util/restrictinfo.c      | 30 ++++++++++++++++++++++++++
src/include/optimizer/restrictinfo.h           |  2 ++
5 files changed, 78 insertions(+), 2 deletions(-)



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

* pgsql: Disallow replacing joins with scans in problematic cases.
@ 2023-07-28 06:51  Etsuro Fujita <efujita@postgresql.org>
  0 siblings, 0 replies; 7+ messages in thread

From: Etsuro Fujita @ 2023-07-28 06:51 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Disallow replacing joins with scans in problematic cases.

Commit e7cb7ee14, which introduced the infrastructure for FDWs and
custom scan providers to replace joins with scans, failed to add support
handling of pseudoconstant quals assigned to replaced joins in
createplan.c, leading to an incorrect plan without a gating Result node
when postgres_fdw replaced a join with such a qual.

To fix, we could add the support by 1) modifying the ForeignPath and
CustomPath structs to store the list of RestrictInfo nodes to apply to
the join, as in JoinPaths, if they represent foreign and custom scans
replacing a join with a scan, and by 2) modifying create_scan_plan() in
createplan.c to use that list in that case, instead of the
baserestrictinfo list, to get pseudoconstant quals assigned to the join;
but #1 would cause an ABI break.  So fix by modifying the infrastructure
to just disallow replacing joins with such quals.

Back-patch to all supported branches.

Reported by Nishant Sharma.  Patch by me, reviewed by Nishant Sharma and
Richard Guo.

Discussion: https://postgr.es/m/CADrsxdbcN1vejBaf8a%2BQhrZY5PXL-04mCd4GDu6qm6FigDZd6Q%40mail.gmail.com

Branch
------
REL_14_STABLE

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

Modified Files
--------------
contrib/postgres_fdw/expected/postgres_fdw.out | 26 +++++++++++++++++++++++
contrib/postgres_fdw/sql/postgres_fdw.sql      |  3 +++
src/backend/optimizer/path/joinpath.c          | 19 +++++++++++++++--
src/backend/optimizer/util/restrictinfo.c      | 29 ++++++++++++++++++++++++++
src/include/optimizer/restrictinfo.h           |  2 ++
5 files changed, 77 insertions(+), 2 deletions(-)



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

* pgsql: Disallow replacing joins with scans in problematic cases.
@ 2023-07-28 06:51  Etsuro Fujita <efujita@postgresql.org>
  0 siblings, 0 replies; 7+ messages in thread

From: Etsuro Fujita @ 2023-07-28 06:51 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Disallow replacing joins with scans in problematic cases.

Commit e7cb7ee14, which introduced the infrastructure for FDWs and
custom scan providers to replace joins with scans, failed to add support
handling of pseudoconstant quals assigned to replaced joins in
createplan.c, leading to an incorrect plan without a gating Result node
when postgres_fdw replaced a join with such a qual.

To fix, we could add the support by 1) modifying the ForeignPath and
CustomPath structs to store the list of RestrictInfo nodes to apply to
the join, as in JoinPaths, if they represent foreign and custom scans
replacing a join with a scan, and by 2) modifying create_scan_plan() in
createplan.c to use that list in that case, instead of the
baserestrictinfo list, to get pseudoconstant quals assigned to the join;
but #1 would cause an ABI break.  So fix by modifying the infrastructure
to just disallow replacing joins with such quals.

Back-patch to all supported branches.

Reported by Nishant Sharma.  Patch by me, reviewed by Nishant Sharma and
Richard Guo.

Discussion: https://postgr.es/m/CADrsxdbcN1vejBaf8a%2BQhrZY5PXL-04mCd4GDu6qm6FigDZd6Q%40mail.gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/6f80a8d9c1373f24ad308b1dee63f8d8c1787026

Modified Files
--------------
contrib/postgres_fdw/expected/postgres_fdw.out | 26 ++++++++++++++++++++++
contrib/postgres_fdw/sql/postgres_fdw.sql      |  3 +++
src/backend/optimizer/path/joinpath.c          | 19 ++++++++++++++--
src/backend/optimizer/util/restrictinfo.c      | 30 ++++++++++++++++++++++++++
src/include/optimizer/restrictinfo.h           |  2 ++
5 files changed, 78 insertions(+), 2 deletions(-)



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

* pgsql: Disallow replacing joins with scans in problematic cases.
@ 2023-07-28 06:51  Etsuro Fujita <efujita@postgresql.org>
  0 siblings, 0 replies; 7+ messages in thread

From: Etsuro Fujita @ 2023-07-28 06:51 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Disallow replacing joins with scans in problematic cases.

Commit e7cb7ee14, which introduced the infrastructure for FDWs and
custom scan providers to replace joins with scans, failed to add support
handling of pseudoconstant quals assigned to replaced joins in
createplan.c, leading to an incorrect plan without a gating Result node
when postgres_fdw replaced a join with such a qual.

To fix, we could add the support by 1) modifying the ForeignPath and
CustomPath structs to store the list of RestrictInfo nodes to apply to
the join, as in JoinPaths, if they represent foreign and custom scans
replacing a join with a scan, and by 2) modifying create_scan_plan() in
createplan.c to use that list in that case, instead of the
baserestrictinfo list, to get pseudoconstant quals assigned to the join;
but #1 would cause an ABI break.  So fix by modifying the infrastructure
to just disallow replacing joins with such quals.

Back-patch to all supported branches.

Reported by Nishant Sharma.  Patch by me, reviewed by Nishant Sharma and
Richard Guo.

Discussion: https://postgr.es/m/CADrsxdbcN1vejBaf8a%2BQhrZY5PXL-04mCd4GDu6qm6FigDZd6Q%40mail.gmail.com

Branch
------
REL_12_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/9edf72aa76441716ce62d1f1787988e160da8115

Modified Files
--------------
contrib/postgres_fdw/expected/postgres_fdw.out | 26 +++++++++++++++++++++++
contrib/postgres_fdw/sql/postgres_fdw.sql      |  3 +++
src/backend/optimizer/path/joinpath.c          | 19 +++++++++++++++--
src/backend/optimizer/util/restrictinfo.c      | 29 ++++++++++++++++++++++++++
src/include/optimizer/restrictinfo.h           |  2 ++
5 files changed, 77 insertions(+), 2 deletions(-)



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

* pgsql: Disallow replacing joins with scans in problematic cases.
@ 2023-07-28 06:51  Etsuro Fujita <efujita@postgresql.org>
  0 siblings, 0 replies; 7+ messages in thread

From: Etsuro Fujita @ 2023-07-28 06:51 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Disallow replacing joins with scans in problematic cases.

Commit e7cb7ee14, which introduced the infrastructure for FDWs and
custom scan providers to replace joins with scans, failed to add support
handling of pseudoconstant quals assigned to replaced joins in
createplan.c, leading to an incorrect plan without a gating Result node
when postgres_fdw replaced a join with such a qual.

To fix, we could add the support by 1) modifying the ForeignPath and
CustomPath structs to store the list of RestrictInfo nodes to apply to
the join, as in JoinPaths, if they represent foreign and custom scans
replacing a join with a scan, and by 2) modifying create_scan_plan() in
createplan.c to use that list in that case, instead of the
baserestrictinfo list, to get pseudoconstant quals assigned to the join;
but #1 would cause an ABI break.  So fix by modifying the infrastructure
to just disallow replacing joins with such quals.

Back-patch to all supported branches.

Reported by Nishant Sharma.  Patch by me, reviewed by Nishant Sharma and
Richard Guo.

Discussion: https://postgr.es/m/CADrsxdbcN1vejBaf8a%2BQhrZY5PXL-04mCd4GDu6qm6FigDZd6Q%40mail.gmail.com

Branch
------
REL_15_STABLE

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

Modified Files
--------------
contrib/postgres_fdw/expected/postgres_fdw.out | 26 +++++++++++++++++++++++
contrib/postgres_fdw/sql/postgres_fdw.sql      |  3 +++
src/backend/optimizer/path/joinpath.c          | 19 +++++++++++++++--
src/backend/optimizer/util/restrictinfo.c      | 29 ++++++++++++++++++++++++++
src/include/optimizer/restrictinfo.h           |  2 ++
5 files changed, 77 insertions(+), 2 deletions(-)



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


end of thread, other threads:[~2023-07-28 06:51 UTC | newest]

Thread overview: 7+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2023-07-28 06:51 pgsql: Disallow replacing joins with scans in problematic cases. Etsuro Fujita <efujita@postgresql.org>
2023-07-28 06:51 pgsql: Disallow replacing joins with scans in problematic cases. Etsuro Fujita <efujita@postgresql.org>
2023-07-28 06:51 pgsql: Disallow replacing joins with scans in problematic cases. Etsuro Fujita <efujita@postgresql.org>
2023-07-28 06:51 pgsql: Disallow replacing joins with scans in problematic cases. Etsuro Fujita <efujita@postgresql.org>
2023-07-28 06:51 pgsql: Disallow replacing joins with scans in problematic cases. Etsuro Fujita <efujita@postgresql.org>
2023-07-28 06:51 pgsql: Disallow replacing joins with scans in problematic cases. Etsuro Fujita <efujita@postgresql.org>
2023-07-28 06:51 pgsql: Disallow replacing joins with scans in problematic cases. Etsuro Fujita <efujita@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