Skip to content

Commit 081a604

Browse files
committed
Fix another oversight in CustomScan patch.
execCurrent.c's search_plan_tree() must recognize a CustomScan on the target relation. This would only be helpful for custom providers that support CurrentOfExpr quals, which is probably a bit far-fetched, but it's not impossible I think. But even without assuming that, we need to recognize a scanned-relation match so that we will properly throw error if the desired relation is being scanned with both a CustomScan and a regular scan (ie, self-join). Also recognize ForeignScanState for similar reasons. Supporting WHERE CURRENT OF on a foreign table is probably even more far-fetched than it is for custom scans, but I think in principle you could do it with postgres_fdw (or another FDW that supports the ctid column). This would be a back-patchable bug fix if existing FDWs handled CurrentOfExpr, but I doubt any do so I won't bother back-patching.
1 parent 03e574a commit 081a604

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/backend/executor/execCurrent.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -258,13 +258,15 @@ search_plan_tree(PlanState *node, Oid table_oid)
258258
switch (nodeTag(node))
259259
{
260260
/*
261-
* scan nodes can all be treated alike
261+
* Relation scan nodes can all be treated alike
262262
*/
263263
case T_SeqScanState:
264264
case T_IndexScanState:
265265
case T_IndexOnlyScanState:
266266
case T_BitmapHeapScanState:
267267
case T_TidScanState:
268+
case T_ForeignScanState:
269+
case T_CustomScanState:
268270
{
269271
ScanState *sstate = (ScanState *) node;
270272

0 commit comments

Comments
 (0)