diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2021-07-06 18:10:11 -0400 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2021-07-06 18:10:20 -0400 |
commit | 955b3e0f9269639fb916cee3dea37aee50b82df0 (patch) | |
tree | 395cf4010f26d0e3f2383f9ad724cb683135acce /src/backend/optimizer/plan/createplan.c | |
parent | 5798ca529935698ab976780565fb2b4d8d34d810 (diff) |
Allow CustomScan providers to say whether they support projections.
Previously, all CustomScan providers had to support projections,
but there may be cases where this is inconvenient. Add a flag
bit to say if it's supported.
Important item for the release notes: this is non-backwards-compatible
since the default is now to assume that CustomScan providers can't
project, instead of assuming that they can. It's fail-soft, but could
result in visible performance penalties due to adding unnecessary
Result nodes.
Sven Klemm, reviewed by Aleksander Alekseev; some cosmetic fiddling
by me.
Discussion: https://postgr.es/m/CAMCrgp1kyakOz6c8aKhNDJXjhQ1dEjEnp+6KNT3KxPrjNtsrDg@mail.gmail.com
Diffstat (limited to 'src/backend/optimizer/plan/createplan.c')
-rw-r--r-- | src/backend/optimizer/plan/createplan.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/backend/optimizer/plan/createplan.c b/src/backend/optimizer/plan/createplan.c index 439e6b6426c..c13da7a879f 100644 --- a/src/backend/optimizer/plan/createplan.c +++ b/src/backend/optimizer/plan/createplan.c @@ -7046,6 +7046,10 @@ is_projection_capable_path(Path *path) case T_MergeAppend: case T_RecursiveUnion: return false; + case T_CustomScan: + if (castNode(CustomPath, path)->flags & CUSTOMPATH_SUPPORT_PROJECTION) + return true; + return false; case T_Append: /* @@ -7092,6 +7096,10 @@ is_projection_capable_plan(Plan *plan) case T_MergeAppend: case T_RecursiveUnion: return false; + case T_CustomScan: + if (((CustomScan *) plan)->flags & CUSTOMPATH_SUPPORT_PROJECTION) + return true; + return false; case T_ProjectSet: /* |