Local execution for insert..select with re-partitioning
- Dominant language
- C
- Stars
- 12.8k
- Forks
- 794
- Avg merge
- 2d 14h
- Merged PRs (30d)
- 31
Description
Currently INSERT..SELECT with re-partitioning throws an error if it is used in a local execution context:
```sql
postgres=# BEGIN;
BEGIN
postgres=# SELECT * FROM test WHERE x = 3;
NOTICE: executing the command locally: SELECT x, y FROM public.test_102056 test WHERE (x OPERATOR(pg_catalog.=) 3)
┌───┬───┐
│ x │ y │
├───┼───┤
└───┴───┘
(0 rows)
postgres=# INSERT INTO test (y, x) SELECT * FROM test;
ERROR: cannot execute command because a local execution has accessed a placement in the transaction
DETAIL: Some parallel commands cannot be executed if a previous command has already been executed locally
HINT: Try re-running the transaction with "SET LOCAL citus.enable_local_execution TO OFF;"
```
We'd likely need some logic to deal with `perPlacementQueries` in `ExtractLocalAndRemoteTasks`
Alternative could be to fall back to execution via the coordinator.
Contributor guide
Assessment
This issue has not been assessed yet.