From 955b3e0f9269639fb916cee3dea37aee50b82df0 Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Tue, 6 Jul 2021 18:10:11 -0400 Subject: 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 --- src/backend/executor/execAmi.c | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) (limited to 'src/backend/executor') diff --git a/src/backend/executor/execAmi.c b/src/backend/executor/execAmi.c index 10f0b349b58..522b1c20863 100644 --- a/src/backend/executor/execAmi.c +++ b/src/backend/executor/execAmi.c @@ -438,13 +438,10 @@ ExecSupportsMarkRestore(Path *pathnode) return true; case T_CustomScan: - { - CustomPath *customPath = castNode(CustomPath, pathnode); + if (castNode(CustomPath, pathnode)->flags & CUSTOMPATH_SUPPORT_MARK_RESTORE) + return true; + return false; - if (customPath->flags & CUSTOMPATH_SUPPORT_MARK_RESTORE) - return true; - return false; - } case T_Result: /* @@ -567,12 +564,8 @@ ExecSupportsBackwardScan(Plan *node) return ExecSupportsBackwardScan(((SubqueryScan *) node)->subplan); case T_CustomScan: - { - uint32 flags = ((CustomScan *) node)->flags; - - if (flags & CUSTOMPATH_SUPPORT_BACKWARD_SCAN) - return true; - } + if (((CustomScan *) node)->flags & CUSTOMPATH_SUPPORT_BACKWARD_SCAN) + return true; return false; case T_SeqScan: -- cgit v1.2.3