citusdata / citusdata/citus

update_distributed_table_colocation doesn't update the partitions' colocation

Open
#7,149 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
C
Stars
12.8k
Forks
794
Avg merge
2d 14h
Merged PRs (30d)
31

Description

in discussion with @AvijitkGupta
Steps to reproduce:
```SQL
CREATE TABLE parent1(id serial NOT NULL, name text COLLATE pg_catalog."default",
created_at timestamp without time zone) PARTITION BY RANGE (created_at);

CREATE TABLE parent1_child1 PARTITION OF parent1
FOR VALUES FROM ('2022-01-01 00:00:00') TO ('2023-01-01 00:00:00') TABLESPACE pg_default;

select create_distributed_table('parent1', 'id');

CREATE TABLE parent2(id serial NOT NULL, name text COLLATE pg_catalog."default",
created_at timestamp without time zone) PARTITION BY RANGE (created_at);

CREATE TABLE parent2_child1 PARTITION OF parent2
FOR VALUES FROM ('2022-01-01 00:00:00') TO ('2023-01-01 00:00:00') TABLESPACE pg_default;

select create_distributed_table('parent2', 'id', colocate_with=>'none');

select logicalrelid, colocationid from pg_dist_partition;
logicalrelid | colocationid
-----------------------------+--------------
parent1 | 1
parent1_child1 | 1
parent2 | 2
parent2_child1 | 2
(4 rows)

select update_distributed_table_colocation('parent2', colocate_with=>'parent1');

-- only parent 2 is colocated with parent 1, parent2's children have other colocation id.
select logicalrelid, colocationid from pg_dist_partition;
logicalrelid | colocationid
-----------------------------+--------------
parent1 | 1
parent1_child1 | 1
parent2 | 1
parent2_child1 | 2
(4 rows)
```

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.