Skip to content

[YSQL] Add tablespace to CREATE TABLEGROUP command #10191

Closed
@timothy-e

Description

CREATE TABLEGROUP name [TABLESPACE tblspacename]

-- yb_tablegroup.sql

CREATE TABLESPACE tblspc WITH (replica_placement='{"num_replicas": 1, "placement_blocks": [{"cloud":"cloud1","region":"datacenter1","zone":"rack1","min_num_replicas":1}]}');
    
-- These should fail. 
CREATE TABLEGROUP grp1 TABLESPACE nonexistentspc;
CREATE TABLEGROUP grp2 TABLESPACE pg_global;  
-- These should succeeed
CREATE TABLEGROUP grp3 TABLESPACE tblspc;

SET default_tablespace = "tblspc";
CREATE TABLEGROUP grp4;
SET default_tablespace = '';

CREATE TABLE tgroup_test6 TABLEGROUP grp3;
-- yb_tablegroup.out

CREATE TABLESPACE tblspc WITH (replica_placement='{"num_replicas": 1, "placement_blocks": [{"cloud":"cloud1","region":"datacenter1","zone":"rack1","min_num_replicas":1}]}');

-- These should fail
CREATE TABLEGROUP grp1 TABLESPACE nonexistentspc;
ERROR: tablespace "nonexistentspc" does not exist
CREATE TABLEGROUP grp2 TABLESPACE pg_global;  
ERROR: cannot use "pg_global" tablespace
-- These should succeeed
CREATE TABLEGROUP grp3 TABLESPACE tblspc;

SET default_tablespace = "tblspc";
CREATE TABLEGROUP grp4;
SET default_tablespace = '';

CREATE TABLE tgroup_test6 TABLEGROUP grp3;

Metadata

Assignees

Labels

area/ysqlYugabyte SQL (YSQL)

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions