incorrect insert error after setting up a foreign key reference from local to distributed table
- Dominant language
- C
- Stars
- 12.8k
- Forks
- 794
- Avg merge
- 2d 14h
- Merged PRs (30d)
- 31
Description
steps
```sql
create table a1(a int primary key, b int, c int);
select create_distributed_table('a1', 'a');
create table a3(a int references a1(a) on delete restrict, b int);
insert into a1 values (1,1,1);
insert into a1 values (2,2,2);
insert into a3 values (2, 6);
ERROR: could not run distributed query with FOR UPDATE/SHARE commands
HINT: Consider using an equality filter on the distributed table's partition column.
CONTEXT: SQL statement "SELECT 1 FROM ONLY "public"."a1" x WHERE "a" OPERATOR(pg_catalog.=) $1 FOR KEY SHARE OF x"
```
I remember seeing `SELECT 1 ...` query from a user conversation.
It is issued from `multi_planner.c::LocalTableEmpty()` function
Contributor guide
Assessment
This issue has not been assessed yet.