Explicitly disallow local rels when inserting into dist table (#6817)

pull/6816/head
Onur Tirtir 2023-04-04 18:46:43 +03:00 committed by GitHub
parent dcee370270
commit d4f9de7875
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 13 additions and 0 deletions

View File

@ -717,6 +717,19 @@ DistributedInsertSelectSupported(Query *queryTree, RangeTblEntry *insertRte,
}
else
{
/*
* Note that we've already checked the non-existence of Postgres
* tables in the subquery.
*/
if (subqueryRteListProperties->hasCitusLocalTable ||
subqueryRteListProperties->hasMaterializedView)
{
return DeferredError(ERRCODE_FEATURE_NOT_SUPPORTED,
"distributed INSERT ... SELECT cannot select from "
"a local relation when inserting into a distributed "
"table", NULL, NULL);
}
/* ensure that INSERT's partition column comes from SELECT's partition column */
error = InsertPartitionColumnMatchesSelect(queryTree, insertRte, subqueryRte,
&selectPartitionColumnTableId);