SELECT .. FOR UPDATE for multi-shard queries are not supported
- Dominant language
- C
- Stars
- 12.8k
- Forks
- 794
- Avg merge
- 2d 14h
- Merged PRs (30d)
- 31
Description
This is a known limitation, opening for better visibility.
```SQL
CREATE TABLE test (x int, y int);
select create_distributed_table('test', 'x');
create_distributed_table
--------------------------
(1 row)
SELECT x FROM test FOR UPDATE;
ERROR: could not run distributed query with FOR UPDATE/SHARE commands
HINT: Consider using an equality filter on the distributed table's partition column.
Time: 0.952 ms
-- more interesting cases are subqueries/CTEs
-- subquery pushdown where some subqueries contain FOR UPDATE
select * from test, (SELECT x FROM test FOR UPDATE) as foo WHERE test.x = foo.x;
ERROR: could not run distributed query with FOR UPDATE/SHARE commands
HINT: Consider using an equality filter on the distributed table's partition column.
Time: 0.532 ms
-- or, only a single CTE contains FOR UPDATE
WITH cte_1 AS (SELECT x FROM test FOR UPDATE) SELECT count(*) FROM test JOIN cte_1 USING(x);
ERROR: could not run distributed query with FOR UPDATE/SHARE commands
HINT: Consider using an equality filter on the distributed table's partition column.
```
Contributor guide
Assessment
This issue has not been assessed yet.