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

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