citusdata / citusdata/citus

When coordinator is added to metadata using citus_set_coordinator_host, creating reference tables chained via foreign keys throws out ERROR.

Open
#6,947 1 comment 0 reactions 0 assignees View on GitHub
bug regression tests
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

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.