Can we include the CustomScan node in the list of nodes that do not support projection? Reason is that custom node can contain quite arbitrary logic that does not guarantee projection support. Secondly. If planner does not need a separate Result node, it just assign tlist to subplan (i.e. changes targetlist of custom node) and does not change the custom_scan_tlist. Perhaps I do not fully understand the logic of using the custom_scan_tlist field. But if into the PlanCustomPath() routine our custom node does not build own custom_scan_tlist (may be it will use tlist as base for custom_scan_tlist) we will get errors in the set_customscan_references() call.

--
Andrey Lepikhov
Postgres Professional
https://postgrespro.com
The Russian Postgres Company
>From 938904d179e0a4e31cbb20fb70243d2b980d8dc2 Mon Sep 17 00:00:00 2001
From: "Andrey V. Lepikhov" <a.lepik...@postgrespro.ru>
Date: Fri, 19 Apr 2019 09:34:09 +0500
Subject: [PATCH] Add CustomScan node in the list of nodes that do not support
 projection

---
 src/backend/optimizer/plan/createplan.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/backend/optimizer/plan/createplan.c b/src/backend/optimizer/plan/createplan.c
index efe073a3ee..682d4d4429 100644
--- a/src/backend/optimizer/plan/createplan.c
+++ b/src/backend/optimizer/plan/createplan.c
@@ -6691,6 +6691,7 @@ is_projection_capable_path(Path *path)
 		case T_ModifyTable:
 		case T_MergeAppend:
 		case T_RecursiveUnion:
+		case T_CustomScan:
 			return false;
 		case T_Append:
 
-- 
2.17.1

Reply via email to