yugabyte-db icon indicating copy to clipboard operation
yugabyte-db copied to clipboard

[YSQL] Colocation: Create table partition fails with colocation option

Open yifanguan opened this issue 1 year ago • 1 comments

Jira Link: DB-9268

Description

For colocation, CREATE <table> PARTITION OF ... WITH (COLOCATION=FALSE/TRUE) fails.

Example:

db1=# CREATE TABLE p4 PARTITION OF t FOR VALUES IN (4) WITH (COLOCATION=FALSE);
ERROR:  cannot use 'colocation=true/false' with tablegroup

Issue Type

kind/bug

Warning: Please confirm that this issue does not contain any sensitive information

  • [X] I confirm this issue does not contain any sensitive information.

yifanguan avatar Dec 13 '23 19:12 yifanguan

Note: We support creating individual partitions as colocated or non-colocated via CREATE + ATTACH:

-- Create partitioned table
CREATE TABLE t (col int) PARTITION BY LIST (col);

-- Create a colocated partition
CREATE TABLE p1 (LIKE t INCLUDING ALL);
ALTER TABLE t ATTACH PARTITION p1 FOR VALUES IN (1);

-- Create a non-colocated partition
CREATE TABLE p2 (LIKE t INCLUDING ALL) WITH (COLOCATION=FALSE);
ALTER TABLE t ATTACH PARTITION p2 FOR VALUES IN (2);

However, if we try to use CREATE <table> PARTITION OF ... WITH (COLOCATION=FALSE) (instead of ATTACH PARTITION), we fail with the above error. This defect tracks fixing this issue.

tverona1 avatar Feb 26 '24 21:02 tverona1

Issue resolved by commit 2cbb49d

yifanguan avatar Apr 02 '24 17:04 yifanguan