github.com/matrixorigin/matrixone@v1.2.0/test/distributed/cases/ddl/alter_publish_subscribe_table.result (about) 1 drop database if exists test; 2 create database test; 3 use test; 4 drop table if exists test01; 5 create table test01( 6 col1 tinyint, 7 col2 smallint, 8 col3 int, 9 col4 bigint, 10 col5 tinyint unsigned, 11 col6 smallint unsigned, 12 col7 int unsigned, 13 col8 bigint unsigned, 14 col9 float, 15 col10 double 16 ); 17 insert into test01 values (1,2,3,4,5,6,7,8,10.2131,3824.34324); 18 insert into test01 values (2,3,4,5,6,7,8,9,2131.3242343,-3824.34324); 19 show create table test01; 20 Table Create Table 21 test01 CREATE TABLE `test01` (\n`col1` TINYINT DEFAULT NULL,\n`col2` SMALLINT DEFAULT NULL,\n`col3` INT DEFAULT NULL,\n`col4` BIGINT DEFAULT NULL,\n`col5` TINYINT UNSIGNED DEFAULT NULL,\n`col6` SMALLINT UNSIGNED DEFAULT NULL,\n`col7` INT UNSIGNED DEFAULT NULL,\n`col8` BIGINT UNSIGNED DEFAULT NULL,\n`col9` FLOAT DEFAULT NULL,\n`col10` DOUBLE DEFAULT NULL\n) 22 create publication publication01 database test; 23 show publications; 24 publication database create_time update_time sub_account comments 25 publication01 test 2024-03-11 16:59:14 null * 26 alter table test01 add primary key (col1, col2); 27 show create table test01; 28 Table Create Table 29 test01 CREATE TABLE `test01` (\n`col1` TINYINT NOT NULL,\n`col2` SMALLINT NOT NULL,\n`col3` INT DEFAULT NULL,\n`col4` BIGINT DEFAULT NULL,\n`col5` TINYINT UNSIGNED DEFAULT NULL,\n`col6` SMALLINT UNSIGNED DEFAULT NULL,\n`col7` INT UNSIGNED DEFAULT NULL,\n`col8` BIGINT UNSIGNED DEFAULT NULL,\n`col9` FLOAT DEFAULT NULL,\n`col10` DOUBLE DEFAULT NULL,\nPRIMARY KEY (`col1`,`col2`)\n) 30 alter table test01 add unique index `ui`(col1, col3); 31 show create table test01; 32 Table Create Table 33 test01 CREATE TABLE `test01` (\n`col1` TINYINT NOT NULL,\n`col2` SMALLINT NOT NULL,\n`col3` INT DEFAULT NULL,\n`col4` BIGINT DEFAULT NULL,\n`col5` TINYINT UNSIGNED DEFAULT NULL,\n`col6` SMALLINT UNSIGNED DEFAULT NULL,\n`col7` INT UNSIGNED DEFAULT NULL,\n`col8` BIGINT UNSIGNED DEFAULT NULL,\n`col9` FLOAT DEFAULT NULL,\n`col10` DOUBLE DEFAULT NULL,\nPRIMARY KEY (`col1`,`col2`),\nUNIQUE KEY `ui` (`col1`,`col3`)\n) 34 alter table test01 drop primary key; 35 show create table test01; 36 Table Create Table 37 test01 CREATE TABLE `test01` (\n`col1` TINYINT NOT NULL,\n`col2` SMALLINT NOT NULL,\n`col3` INT DEFAULT NULL,\n`col4` BIGINT DEFAULT NULL,\n`col5` TINYINT UNSIGNED DEFAULT NULL,\n`col6` SMALLINT UNSIGNED DEFAULT NULL,\n`col7` INT UNSIGNED DEFAULT NULL,\n`col8` BIGINT UNSIGNED DEFAULT NULL,\n`col9` FLOAT DEFAULT NULL,\n`col10` DOUBLE DEFAULT NULL,\nUNIQUE KEY `ui` (`col1`,`col3`)\n) 38 alter table test01 add primary key (col10); 39 show create table test01; 40 Table Create Table 41 test01 CREATE TABLE `test01` (\n`col1` TINYINT NOT NULL,\n`col2` SMALLINT NOT NULL,\n`col3` INT DEFAULT NULL,\n`col4` BIGINT DEFAULT NULL,\n`col5` TINYINT UNSIGNED DEFAULT NULL,\n`col6` SMALLINT UNSIGNED DEFAULT NULL,\n`col7` INT UNSIGNED DEFAULT NULL,\n`col8` BIGINT UNSIGNED DEFAULT NULL,\n`col9` FLOAT DEFAULT NULL,\n`col10` DOUBLE NOT NULL,\nPRIMARY KEY (`col10`),\nUNIQUE KEY `ui` (`col1`,`col3`)\n) 42 alter table test01 add column newCol int after col1; 43 select * from test01; 44 col1 newcol col2 col3 col4 col5 col6 col7 col8 col9 col10 45 1 null 2 3 4 5 6 7 8 10.2131 3824.34324 46 2 null 3 4 5 6 7 8 9 2131.3242 -3824.34324 47 show create table test01; 48 Table Create Table 49 test01 CREATE TABLE `test01` (\n`col1` TINYINT NOT NULL,\n`newcol` INT DEFAULT NULL,\n`col2` SMALLINT NOT NULL,\n`col3` INT DEFAULT NULL,\n`col4` BIGINT DEFAULT NULL,\n`col5` TINYINT UNSIGNED DEFAULT NULL,\n`col6` SMALLINT UNSIGNED DEFAULT NULL,\n`col7` INT UNSIGNED DEFAULT NULL,\n`col8` BIGINT UNSIGNED DEFAULT NULL,\n`col9` FLOAT DEFAULT NULL,\n`col10` DOUBLE NOT NULL,\nPRIMARY KEY (`col10`),\nUNIQUE KEY `ui` (`col1`,`col3`)\n) 50 alter table test01 modify column col1 decimal; 51 show create table test01; 52 Table Create Table 53 test01 CREATE TABLE `test01` (\n`col1` DECIMAL(38,0) DEFAULT NULL,\n`newcol` INT DEFAULT NULL,\n`col2` SMALLINT NOT NULL,\n`col3` INT DEFAULT NULL,\n`col4` BIGINT DEFAULT NULL,\n`col5` TINYINT UNSIGNED DEFAULT NULL,\n`col6` SMALLINT UNSIGNED DEFAULT NULL,\n`col7` INT UNSIGNED DEFAULT NULL,\n`col8` BIGINT UNSIGNED DEFAULT NULL,\n`col9` FLOAT DEFAULT NULL,\n`col10` DOUBLE NOT NULL,\nPRIMARY KEY (`col10`),\nUNIQUE KEY `ui` (`col1`,`col3`)\n) 54 show publications; 55 publication database create_time update_time sub_account comments 56 publication01 test 2024-03-11 16:59:14 null * 57 drop publication publication01; 58 drop table test01; 59 drop database test; 60 drop account if exists acc0; 61 create account acc0 admin_name 'root' identified by '111'; 62 drop database if exists sys_db_1; 63 create database sys_db_1; 64 use sys_db_1; 65 create table sys_tbl_1(a int primary key, b decimal, c char, d varchar(20) ); 66 insert into sys_tbl_1 values(1,2,'a','database'),(2,3,'b','test publication'),(3, 4, 'c','324243243'); 67 create publication sys_pub_1 database sys_db_1; 68 select * from sys_tbl_1; 69 a b c d 70 1 2 a database 71 2 3 b test publication 72 3 4 c 324243243 73 show publications; 74 publication database create_time update_time sub_account comments 75 sys_pub_1 sys_db_1 2024-03-11 16:59:15 null * 76 select pub_name, database_name, account_list from mo_catalog.mo_pubs; 77 pub_name database_name account_list 78 sys_pub_1 sys_db_1 all 79 create database sub1 from sys publication sys_pub_1; 80 show databases; 81 Database 82 information_schema 83 mo_catalog 84 mysql 85 sub1 86 system 87 system_metrics 88 show subscriptions; 89 pub_name pub_account pub_database pub_time sub_name sub_time 90 use sys_db_1; 91 alter table sys_tbl_1 drop primary key; 92 show create table sys_tbl_1; 93 Table Create Table 94 sys_tbl_1 CREATE TABLE `sys_tbl_1` (\n`a` INT NOT NULL,\n`b` DECIMAL(38,0) DEFAULT NULL,\n`c` CHAR(1) DEFAULT NULL,\n`d` VARCHAR(20) DEFAULT NULL\n) 95 alter table sys_tbl_1 add primary key(a,b); 96 show create table sys_tbl_1; 97 Table Create Table 98 sys_tbl_1 CREATE TABLE `sys_tbl_1` (\n`a` INT NOT NULL,\n`b` DECIMAL(38,0) NOT NULL,\n`c` CHAR(1) DEFAULT NULL,\n`d` VARCHAR(20) DEFAULT NULL,\nPRIMARY KEY (`a`,`b`)\n) 99 alter table sys_tbl_1 add unique index `b`(b,c); 100 show create table sys_tbl_1; 101 Table Create Table 102 sys_tbl_1 CREATE TABLE `sys_tbl_1` (\n`a` INT NOT NULL,\n`b` DECIMAL(38,0) NOT NULL,\n`c` CHAR(1) DEFAULT NULL,\n`d` VARCHAR(20) DEFAULT NULL,\nPRIMARY KEY (`a`,`b`),\nUNIQUE KEY `b` (`b`,`c`)\n) 103 alter table sys_tbl_1 modify column a char after c; 104 show create table sys_tbl_1; 105 Table Create Table 106 sys_tbl_1 CREATE TABLE `sys_tbl_1` (\n`b` DECIMAL(38,0) NOT NULL,\n`c` CHAR(1) DEFAULT NULL,\n`a` CHAR(1) NOT NULL,\n`d` VARCHAR(20) DEFAULT NULL,\nPRIMARY KEY (`a`,`b`),\nUNIQUE KEY `b` (`b`,`c`)\n) 107 drop database sub1; 108 drop account acc0; 109 drop publication sys_pub_1; 110 drop database sys_db_1;