When coordinator is added to metadata using citus_set_coordinator_host, creating reference tables chained via foreign keys throws out ERROR.
- Dominant language
- C
- Stars
- 12.8k
- Forks
- 794
- Avg merge
- 2d 14h
- Merged PRs (30d)
- 31
Description
Repro steps:
```
SELECT citus_set_coordinator_host('localhost');
CREATE TABLE ref_table_1(id int primary key, v int);
CREATE TABLE ref_table_2(id int primary key, v int references ref_table_1(id));
CREATE TABLE ref_table_3(id int primary key, v int references ref_table_2(id));
SELECT create_reference_table('ref_table_1'),
create_reference_table('ref_table_2'),
create_reference_table('ref_table_3');
CREATE TABLE
CREATE TABLE
CREATE TABLE
NOTICE: local tables that are added to metadata automatically by citus, but not chained with reference tables via foreign keys might be automatically converted back to postgres tables
HINT: Executing citus_add_local_table_to_metadata($$public.ref_table_2$$) prevents this for the given relation, and all of the connected relations
NOTICE: local tables that are added to metadata automatically by citus, but not chained with reference tables via foreign keys might be automatically converted back to postgres tables
HINT: Executing citus_add_local_table_to_metadata($$public.ref_table_2$$) prevents this for the given relation, and all of the connected relations
NOTICE: local tables that are added to metadata automatically by citus, but not chained with reference tables via foreign keys might be automatically converted back to postgres tables
HINT: Executing citus_add_local_table_to_metadata($$public.ref_table_3$$) prevents this for the given relation, and all of the connected relations
ERROR: relation "ref_table_2_102024" is a shard relation
```
The same scenario works as expected when we remove the coordinator
```
select master_remove_node('localhost', :master_port);
SELECT create_reference_table('ref_table_1'),
create_reference_table('ref_table_2'),
create_reference_table('ref_table_3');
create_reference_table | create_reference_table | create_reference_table
------------------------+------------------------+------------------------
| |
(1 row)
```
Contributor guide
Assessment
This issue has not been assessed yet.