Data node scan doesn't support system columns: move this check to an appropriate place

Before, we would complain that we don't support fetching the system
columns with per-data node queries enabled, but still execute the code
that fetches it. Don't do this and complain earlier.
This commit is contained in:
Alexander Kuzmenkov 2022-04-04 12:50:22 +03:00 committed by Alexander Kuzmenkov
parent a064fd3b48
commit ff945a7a94
2 changed files with 9 additions and 9 deletions

View File

@ -66,15 +66,6 @@ data_node_scan_next(CustomScanState *node)
slot = fdw_scan_iterate(&node->ss, &sss->fsstate);
MemoryContextSwitchTo(oldcontext);
/* Raise an error when system column is requsted, eg. tableoid */
if (sss->systemcol && !TupIsNull(slot))
ereport(ERROR,
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
errmsg("system columns are not accessible on distributed hypertables with current "
"settings"),
errhint("Set timescaledb.enable_per_data_node_queries=false to query system "
"columns.")));
return slot;
}

View File

@ -634,6 +634,15 @@ data_node_scan_plan_create(PlannerInfo *root, RelOptInfo *rel, CustomPath *best_
bms_free(attrs_used);
}
/* Raise an error when system column is requsted, eg. tableoid */
if (scaninfo.systemcol)
ereport(ERROR,
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
errmsg("system columns are not accessible on distributed hypertables with current "
"settings"),
errhint("Set timescaledb.enable_per_data_node_queries=false to query system "
"columns.")));
/* Should have determined the fetcher type by now. */
Assert(ts_data_node_fetcher_scan_type != AutoFetcherType);