diff options
author | Etsuro Fujita <efujita@postgresql.org> | 2023-08-15 16:45:00 +0900 |
---|---|---|
committer | Etsuro Fujita <efujita@postgresql.org> | 2023-08-15 16:45:00 +0900 |
commit | 9e9931d2bf40e2fea447d779c2e133c2c1256ef3 (patch) | |
tree | 33ece047786463ecd497cdd8178ca51e5f65c200 /src/include/nodes/pathnodes.h | |
parent | 5ffb7c775062ef18756e515ac96f06d012cbb950 (diff) |
Re-allow FDWs and custom scan providers to replace joins with pseudoconstant quals.
This was disabled in commit 6f80a8d9c due to the lack of support for
handling of pseudoconstant quals assigned to replaced joins in
createplan.c. To re-allow it, this patch adds the support by 1)
modifying the ForeignPath and CustomPath structs so that if they
represent foreign and custom scans replacing a join with a scan, they
store the list of RestrictInfo nodes to apply to the join, as in
JoinPaths, and by 2) modifying create_scan_plan() in createplan.c so
that it uses that list in that case, instead of the baserestrictinfo
list, to get pseudoconstant quals assigned to the join, as mentioned in
the commit message for that commit.
Important item for the release notes: this is non-backwards-compatible
since it modifies the ForeignPath and CustomPath structs, as mentioned
above, and changes the argument lists for FDW helper functions
create_foreignscan_path(), create_foreign_join_path(), and
create_foreign_upper_path().
Richard Guo, with some additional changes by me, reviewed by Nishant
Sharma, Suraj Kharage, and Richard Guo.
Discussion: https://postgr.es/m/CADrsxdbcN1vejBaf8a%2BQhrZY5PXL-04mCd4GDu6qm6FigDZd6Q%40mail.gmail.com
Diffstat (limited to 'src/include/nodes/pathnodes.h')
-rw-r--r-- | src/include/nodes/pathnodes.h | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/include/nodes/pathnodes.h b/src/include/nodes/pathnodes.h index a1dc1d07e18..5702fbba60c 100644 --- a/src/include/nodes/pathnodes.h +++ b/src/include/nodes/pathnodes.h @@ -1822,6 +1822,10 @@ typedef struct SubqueryScanPath * ForeignPath represents a potential scan of a foreign table, foreign join * or foreign upper-relation. * + * In the case of a foreign join, fdw_restrictinfo stores the RestrictInfos to + * apply to the join, which are used by createplan.c to get pseudoconstant + * clauses evaluated as one-time quals in a gating Result plan node. + * * fdw_private stores FDW private data about the scan. While fdw_private is * not actually touched by the core code during normal operations, it's * generally a good idea to use a representation that can be dumped by @@ -1832,6 +1836,7 @@ typedef struct ForeignPath { Path path; Path *fdw_outerpath; + List *fdw_restrictinfo; List *fdw_private; } ForeignPath; @@ -1849,6 +1854,10 @@ typedef struct ForeignPath * relation by set_rel_pathlist_hook or set_join_pathlist_hook functions, * respectively. * + * In the case of a table join, custom_restrictinfo stores the RestrictInfos + * to apply to the join, which are used by createplan.c to get pseudoconstant + * clauses evaluated as one-time quals in a gating Result plan node. + * * Core code must avoid assuming that the CustomPath is only as large as * the structure declared here; providers are allowed to make it the first * element in a larger structure. (Since the planner never copies Paths, @@ -1865,6 +1874,7 @@ typedef struct CustomPath uint32 flags; /* mask of CUSTOMPATH_* flags, see * nodes/extensible.h */ List *custom_paths; /* list of child Path nodes, if any */ + List *custom_restrictinfo; List *custom_private; const struct CustomPathMethods *methods; } CustomPath; |