citusdata / citusdata/citus

Distributing Partitioned Table with colocate_with:='none' Distributes Partitions into Different Colocations

Open
#4,467 0 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
C
Stars
12.8k
Forks
794
Avg merge
2d 14h
Merged PRs (30d)
31

Description

If we try to attach a distributed partition to a distributed parent table when the are not colocated, we error out nicely about how parent and child needs to be colocated. But if we distribute a partitioned table with `colocate_with:='none'` we put parent and child tables into different colocations groups.

```
CREATE TABLE oz (a INT) PARTITION BY RANGE (a);
CREATE TABLE oz_1 (a INT);
SELECT create_distributed_table('oz', 'a');
SELECT create_distributed_table('oz_1', 'a', colocate_with:='none');

ALTER TABLE oz ATTACH PARTITION oz_1 FOR VALUES FROM (1) TO (5);

-- ERROR: distributed tables cannot have non-colocated distributed tables as a partition

SELECT undistribute_table('oz');
SELECT undistribute_table('oz_1');
ALTER TABLE oz ATTACH PARTITION oz_1 FOR VALUES FROM (1) TO (5);
SELECT create_distributed_table('oz', 'a', colocate_with:='none');

SELECT "Name", "Colocation ID" FROM citus_tables;

┌──────┬───────────────┐
│ Name │ Colocation ID │
├──────┼───────────────┤
│ oz │ 4 │
│ oz_1 │ 5 │
└──────┴───────────────┘
```

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.