github.com/matrixorigin/matrixone@v0.7.0/test/distributed/cases/tenant/clustertable3.sql (about)

     1  drop account if exists acc1;
     2  create account acc1 admin_name = 'r1' identified by '111' open comment 'acc1';
     3  
     4  use mo_catalog;
     5  drop table if exists a;
     6  
     7  -- cluster table
     8  CREATE CLUSTER TABLE a (`id` varchar(128) NOT NULL,
     9      `name` VARCHAR(255) NOT NULL,
    10      `account_name` varchar(128) NOT NULL,
    11      PRIMARY KEY (`id`),
    12      UNIQUE INDEX `uniq_acc` (`account_name`));
    13  
    14  insert into a accounts(acc1) values (0,"abc","acc1");
    15  insert into a accounts(acc1) values (1,"bcd","acc2");
    16  
    17  -- check it in the non-sys account
    18  -- @session:id=2&user=acc1:r1&password=111
    19  use mo_catalog;
    20  select * from a;
    21  -- @session
    22  
    23  update a set `account_name` = "cde" where id = 1;
    24  update a set `account_name` = "cde" where id = 1;
    25  update a set `name` = "xxx" where `account_name` = "cde";
    26  update a set `id` = 3 where `id` = 1;
    27  update a set `id` = 3, `account_name`='qwe' where `id` = 3;
    28  delete from a where `id` = 1;
    29  
    30  -- check it in the non-sys account
    31  -- @session:id=2&user=acc1:r1&password=111
    32  use mo_catalog;
    33  select * from a;
    34  -- @session
    35  
    36  drop table if exists a;
    37  drop account if exists acc1;