github.com/matrixorigin/matrixone@v1.2.0/test/distributed/cases/ddl/alter.result (about)

     1  create database test;
     2  use test;
     3  drop table if exists foreign01;
     4  create table foreign01(col1 int primary key,
     5  col2 varchar(20),
     6  col3 int,
     7  col4 bigint);
     8  insert into foreign01 values(1,'shujuku',100,3247984);
     9  insert into foreign01 values(2,'数据库',328932,32324423432);
    10  drop table if exists foreign02;
    11  create table foreign02(col1 int,
    12  col2 int,
    13  col3 int primary key,
    14  constraint fk foreign key fk(col1) references foreign01(col1));
    15  insert into foreign02 values(1,1,1);
    16  insert into foreign02 values(2,2,2);
    17  delete from foreign01 where col3 = 100;
    18  internal error: Cannot delete or update a parent row: a foreign key constraint fails
    19  show create table foreign02;
    20  Table    Create Table
    21  foreign02    CREATE TABLE `foreign02` (\n`col1` INT DEFAULT NULL,\n`col2` INT DEFAULT NULL,\n`col3` INT NOT NULL,\nPRIMARY KEY (`col3`),\nCONSTRAINT `fk` FOREIGN KEY (`col1`) REFERENCES `foreign01` (`col1`) ON DELETE RESTRICT ON UPDATE RESTRICT\n)
    22  alter table foreign02 drop foreign key fk;
    23  show create table foreign02;
    24  Table    Create Table
    25  foreign02    CREATE TABLE `foreign02` (\n`col1` INT DEFAULT NULL,\n`col2` INT DEFAULT NULL,\n`col3` INT NOT NULL,\nPRIMARY KEY (`col3`)\n)
    26  drop table foreign01;
    27  drop table foreign02;
    28  drop table if exists ti1;
    29  drop table if exists tm1;
    30  drop table if exists ti2;
    31  drop table if exists tm2;
    32  create  table ti1(a INT not null, b INT, c INT);
    33  create  table tm1(a INT not null, b INT, c INT);
    34  create  table ti2(a INT primary key AUTO_INCREMENT, b INT, c INT);
    35  create  table tm2(a INT primary key AUTO_INCREMENT, b INT, c INT);
    36  insert into ti1 values (1,1,1), (2,2,2);
    37  insert into ti2 values (1,1,1), (2,2,2);
    38  insert into tm1 values (1,1,1), (2,2,2);
    39  insert into tm2 values (1,1,1), (2,2,2);
    40  alter table ti1 add constraint fi1 foreign key (b) references ti2(a);
    41  alter table tm1 add constraint fm1 foreign key (b) references tm2(a);
    42  show create table ti1;
    43  Table    Create Table
    44  ti1    CREATE TABLE `ti1` (\n`a` INT NOT NULL,\n`b` INT DEFAULT NULL,\n`c` INT DEFAULT NULL,\nCONSTRAINT `fi1` FOREIGN KEY (`b`) REFERENCES `ti2` (`a`) ON DELETE RESTRICT ON UPDATE RESTRICT\n)
    45  show create table tm1;
    46  Table    Create Table
    47  tm1    CREATE TABLE `tm1` (\n`a` INT NOT NULL,\n`b` INT DEFAULT NULL,\n`c` INT DEFAULT NULL,\nCONSTRAINT `fm1` FOREIGN KEY (`b`) REFERENCES `tm2` (`a`) ON DELETE RESTRICT ON UPDATE RESTRICT\n)
    48  delete from ti2 where c = 1;
    49  internal error: Cannot delete or update a parent row: a foreign key constraint fails
    50  delete from tm2 where c = 1;
    51  internal error: Cannot delete or update a parent row: a foreign key constraint fails
    52  alter table ti1 drop foreign key fi1;
    53  alter table tm1 drop foreign key fm1;
    54  show create table ti1;
    55  Table    Create Table
    56  ti1    CREATE TABLE `ti1` (\n`a` INT NOT NULL,\n`b` INT DEFAULT NULL,\n`c` INT DEFAULT NULL\n)
    57  show create table tm1;
    58  Table    Create Table
    59  tm1    CREATE TABLE `tm1` (\n`a` INT NOT NULL,\n`b` INT DEFAULT NULL,\n`c` INT DEFAULT NULL\n)
    60  delete from ti2 where c = 1;
    61  delete from tm2 where c = 1;
    62  drop table  ti1;
    63  drop table  tm1;
    64  drop table  ti2;
    65  drop table  tm2;
    66  drop table if exists foreign01;
    67  [unknown result because it is related to issue#9282]
    68  create temporary table foreign01(col1 int primary key,
    69  col2 varchar(20),
    70  col3 int,
    71  col4 bigint);
    72  [unknown result because it is related to issue#9282]
    73  insert into foreign01 values(1,'shujuku',100,3247984);
    74  [unknown result because it is related to issue#9282]
    75  insert into foreign01 values(2,'数据库',328932,32324423432);
    76  [unknown result because it is related to issue#9282]
    77  drop table if exists foreign02;
    78  [unknown result because it is related to issue#9282]
    79  create temporary table foreign02(col1 int,
    80  col2 int,
    81  col3 int primary key,
    82  constraint fk foreign key fk(col1) references foreign01(col1));
    83  [unknown result because it is related to issue#9282]
    84  insert into foreign02 values(1,1,1);
    85  [unknown result because it is related to issue#9282]
    86  insert into foreign02 values(2,2,2);
    87  [unknown result because it is related to issue#9282]
    88  delete from foreign01 where col3 = 100;
    89  [unknown result because it is related to issue#9282]
    90  show create table foreign02;
    91  [unknown result because it is related to issue#9282]
    92  alter table foreign02 drop foreign key fk;
    93  [unknown result because it is related to issue#9282]
    94  show create table foreign02;
    95  [unknown result because it is related to issue#9282]
    96  drop table foreign01;
    97  [unknown result because it is related to issue#9282]
    98  drop table foreign02;
    99  [unknown result because it is related to issue#9282]
   100  drop table if exists ti1;
   101  [unknown result because it is related to issue#9282]
   102  drop table if exists tm1;
   103  [unknown result because it is related to issue#9282]
   104  drop table if exists ti2;
   105  [unknown result because it is related to issue#9282]
   106  drop table if exists tm2;
   107  [unknown result because it is related to issue#9282]
   108  create temporary table ti1(a INT not null, b INT, c INT);
   109  [unknown result because it is related to issue#9282]
   110  create temporary table tm1(a INT not null, b INT, c INT);
   111  [unknown result because it is related to issue#9282]
   112  create temporary table ti2(a INT primary key AUTO_INCREMENT, b INT, c INT);
   113  [unknown result because it is related to issue#9282]
   114  create temporary table tm2(a INT primary key AUTO_INCREMENT, b INT, c INT);
   115  [unknown result because it is related to issue#9282]
   116  insert into ti1 values (1,1,1), (2,2,2);
   117  [unknown result because it is related to issue#9282]
   118  insert into ti2 values (1,1,1), (2,2,2);
   119  [unknown result because it is related to issue#9282]
   120  insert into tm1 values (1,1,1), (2,2,2);
   121  [unknown result because it is related to issue#9282]
   122  insert into tm2 values (1,1,1), (2,2,2);
   123  [unknown result because it is related to issue#9282]
   124  alter table ti1 add constraint fi1 foreign key (b) references ti2(a);
   125  [unknown result because it is related to issue#9282]
   126  alter table tm1 add constraint fm1 foreign key (b) references tm2(a);
   127  [unknown result because it is related to issue#9282]
   128  show create table ti1;
   129  [unknown result because it is related to issue#9282]
   130  show create table tm1;
   131  [unknown result because it is related to issue#9282]
   132  delete from ti2 where c = 1;
   133  [unknown result because it is related to issue#9282]
   134  delete from tm2 where c = 1;
   135  [unknown result because it is related to issue#9282]
   136  alter table ti1 drop foreign key fi1;
   137  [unknown result because it is related to issue#9282]
   138  alter table tm1 drop foreign key fm1;
   139  [unknown result because it is related to issue#9282]
   140  show create table ti1;
   141  [unknown result because it is related to issue#9282]
   142  show create table tm1;
   143  [unknown result because it is related to issue#9282]
   144  delete from ti2 where c = 1;
   145  [unknown result because it is related to issue#9282]
   146  delete from tm2 where c = 1;
   147  [unknown result because it is related to issue#9282]
   148  drop table  ti1;
   149  [unknown result because it is related to issue#9282]
   150  drop table  tm1;
   151  [unknown result because it is related to issue#9282]
   152  drop table  ti2;
   153  [unknown result because it is related to issue#9282]
   154  drop table  tm2;
   155  [unknown result because it is related to issue#9282]
   156  drop table if exists index01;
   157  create table index01(col1 int,key key1(col1));
   158  show index from index01;
   159  Table    Non_unique    Key_name    Seq_in_index    Column_name    Collation    Cardinality    Sub_part    Packed    Null    Index_type    Comment    Index_comment    Index_params    Visible    Expression
   160  index01    1    key1    1    col1    A    0    NULL    NULL    YES                    YES    NULL
   161  alter table index01 drop index key1;
   162  show index from index01;
   163  Table    Non_unique    Key_name    Seq_in_index    Column_name    Collation    Cardinality    Sub_part    Packed    Null    Index_type    Comment    Index_comment    Index_params    Visible    Expression
   164  alter table Index01 add index key1(col1) comment 'test';
   165  show index from index01;
   166  Table    Non_unique    Key_name    Seq_in_index    Column_name    Collation    Cardinality    Sub_part    Packed    Null    Index_type    Comment    Index_comment    Index_params    Visible    Expression
   167  index01    1    key1    1    col1    A    0    NULL    NULL    YES            test        YES    NULL
   168  alter table index01 alter index key1 invisible;
   169  show index from index01;
   170  Table    Non_unique    Key_name    Seq_in_index    Column_name    Collation    Cardinality    Sub_part    Packed    Null    Index_type    Comment    Index_comment    Index_params    Visible    Expression
   171  index01    1    key1    1    col1    A    0    NULL    NULL    YES            test        NO    NULL
   172  drop table index01;
   173  drop table if exists index02;
   174  create table index02(col1 int,key key1(col1) comment 'test');
   175  alter table index02 drop index key1;
   176  show index from index02;
   177  Table    Non_unique    Key_name    Seq_in_index    Column_name    Collation    Cardinality    Sub_part    Packed    Null    Index_type    Comment    Index_comment    Index_params    Visible    Expression
   178  alter table index02 add index Key1(col1);
   179  alter table index02 alter index key1 invisible;
   180  show index from index02;
   181  Table    Non_unique    Key_name    Seq_in_index    Column_name    Collation    Cardinality    Sub_part    Packed    Null    Index_type    Comment    Index_comment    Index_params    Visible    Expression
   182  index02    1    key1    1    col1    A    0    NULL    NULL    YES                    NO    NULL
   183  drop table index02;
   184  drop table if exists index03;
   185  create table index03(col1 int, col2 int, col3 int);
   186  alter table index03 add unique key(col1,col2) comment 'abcTest';
   187  show index from index03;
   188  Table    Non_unique    Key_name    Seq_in_index    Column_name    Collation    Cardinality    Sub_part    Packed    Null    Index_type    Comment    Index_comment    Index_params    Visible    Expression
   189  index03    0    col1    1    col1    A    0    NULL    NULL    YES            abcTest        YES    NULL
   190  index03    0    col1    2    col2    A    0    NULL    NULL    YES            abcTest        YES    NULL
   191  alter table index03 alter index col1 invisible;
   192  show index from index03;
   193  Table    Non_unique    Key_name    Seq_in_index    Column_name    Collation    Cardinality    Sub_part    Packed    Null    Index_type    Comment    Index_comment    Index_params    Visible    Expression
   194  index03    0    col1    1    col1    A    0    NULL    NULL    YES            abcTest        NO    NULL
   195  index03    0    col1    2    col2    A    0    NULL    NULL    YES            abcTest        NO    NULL
   196  drop table index03;
   197  drop table if exists index03;
   198  create table index03(fld1 int, key key1(fld1) comment 'test');
   199  show index from index03;
   200  Table    Non_unique    Key_name    Seq_in_index    Column_name    Collation    Cardinality    Sub_part    Packed    Null    Index_type    Comment    Index_comment    Index_params    Visible    Expression
   201  index03    1    key1    1    fld1    A    0    NULL    NULL    YES            test        YES    NULL
   202  alter table index03 drop index key1;
   203  show index from index03;
   204  Table    Non_unique    Key_name    Seq_in_index    Column_name    Collation    Cardinality    Sub_part    Packed    Null    Index_type    Comment    Index_comment    Index_params    Visible    Expression
   205  drop table index03;
   206  drop table if exists index04;
   207  create table index04(col1 int, col2 char, col3 varchar(10),primary key(col1,col2));
   208  show index from index04;
   209  Table    Non_unique    Key_name    Seq_in_index    Column_name    Collation    Cardinality    Sub_part    Packed    Null    Index_type    Comment    Index_comment    Index_params    Visible    Expression
   210  index04    0    PRIMARY    1    col1    A    0    NULL    NULL                        YES    NULL
   211  index04    0    PRIMARY    2    col2    A    0    NULL    NULL                        YES    NULL
   212  alter table index04 add index(col1);
   213  alter table index04 alter index col1 invisible;
   214  show index from index04;
   215  Table    Non_unique    Key_name    Seq_in_index    Column_name    Collation    Cardinality    Sub_part    Packed    Null    Index_type    Comment    Index_comment    Index_params    Visible    Expression
   216  index04    0    PRIMARY    1    col1    A    0    NULL    NULL                        YES    NULL
   217  index04    0    PRIMARY    2    col2    A    0    NULL    NULL                        YES    NULL
   218  index04    1    col1    1    col1    A    0    NULL    NULL                        NO    NULL
   219  alter table index04 alter index col1 visible;
   220  show index from index04;
   221  Table    Non_unique    Key_name    Seq_in_index    Column_name    Collation    Cardinality    Sub_part    Packed    Null    Index_type    Comment    Index_comment    Index_params    Visible    Expression
   222  index04    0    PRIMARY    1    col1    A    0    NULL    NULL                        YES    NULL
   223  index04    0    PRIMARY    2    col2    A    0    NULL    NULL                        YES    NULL
   224  index04    1    col1    1    col1    A    0    NULL    NULL                        YES    NULL
   225  drop table index04;
   226  drop table if exists index05;
   227  create table index05(col1 int, col2 bigint, col3 decimal);
   228  show index from index05;
   229  Table    Non_unique    Key_name    Seq_in_index    Column_name    Collation    Cardinality    Sub_part    Packed    Null    Index_type    Comment    Index_comment    Index_params    Visible    Expression
   230  alter table index05 add unique key(col1,col2);
   231  show index from index05;
   232  Table    Non_unique    Key_name    Seq_in_index    Column_name    Collation    Cardinality    Sub_part    Packed    Null    Index_type    Comment    Index_comment    Index_params    Visible    Expression
   233  index05    0    col1    1    col1    A    0    NULL    NULL    YES                    YES    NULL
   234  index05    0    col1    2    col2    A    0    NULL    NULL    YES                    YES    NULL
   235  alter table index05 alter index col1 invisible;
   236  show index from index05;
   237  Table    Non_unique    Key_name    Seq_in_index    Column_name    Collation    Cardinality    Sub_part    Packed    Null    Index_type    Comment    Index_comment    Index_params    Visible    Expression
   238  index05    0    col1    1    col1    A    0    NULL    NULL    YES                    NO    NULL
   239  index05    0    col1    2    col2    A    0    NULL    NULL    YES                    NO    NULL
   240  drop table index05;
   241  drop table if exists index06;
   242  create table index06(col1 int not null,col2 binary, col3 float,unique key(col1));
   243  alter table index06 add unique index(col2);
   244  show index from index06;
   245  Table    Non_unique    Key_name    Seq_in_index    Column_name    Collation    Cardinality    Sub_part    Packed    Null    Index_type    Comment    Index_comment    Index_params    Visible    Expression
   246  index06    0    col1    1    col1    A    0    NULL    NULL                        YES    NULL
   247  index06    0    col2    1    col2    A    0    NULL    NULL    YES                    YES    NULL
   248  alter table index06 alter index col2 invisible;
   249  show index from index06;
   250  Table    Non_unique    Key_name    Seq_in_index    Column_name    Collation    Cardinality    Sub_part    Packed    Null    Index_type    Comment    Index_comment    Index_params    Visible    Expression
   251  index06    0    col1    1    col1    A    0    NULL    NULL                        YES    NULL
   252  index06    0    col2    1    col2    A    0    NULL    NULL    YES                    NO    NULL
   253  drop table index06;
   254  drop table if exists index07;
   255  CREATE TABLE index07(
   256  col1 INT NOT NULL,
   257  col2 DATE NOT NULL,
   258  col3 VARCHAR(16) NOT NULL,
   259  col4 int unsigned NOT NULL,
   260  PRIMARY KEY(col1)
   261  );
   262  insert into index07 values(1, '1980-12-17','Abby', 21);
   263  insert into index07 values(2, '1981-02-20','Bob', 22);
   264  insert into index07 values(3, '1981-02-22','Carol', 23);
   265  alter table index07 add constraint unique key (col3, col4);
   266  alter table index07 add constraint unique key wwwww (col3, col4);
   267  alter table index07 add constraint abctestabbc unique key zxxxxx (col3);
   268  show index from index07;
   269  Table    Non_unique    Key_name    Seq_in_index    Column_name    Collation    Cardinality    Sub_part    Packed    Null    Index_type    Comment    Index_comment    Index_params    Visible    Expression
   270  index07    0    PRIMARY    1    col1    A    0    NULL    NULL                        YES    NULL
   271  index07    0    col3    1    col3    A    0    NULL    NULL                        YES    NULL
   272  index07    0    col3    2    col4    A    0    NULL    NULL                        YES    NULL
   273  index07    0    wwwww    1    col3    A    0    NULL    NULL                        YES    NULL
   274  index07    0    wwwww    2    col4    A    0    NULL    NULL                        YES    NULL
   275  index07    0    zxxxxx    1    col3    A    0    NULL    NULL                        YES    NULL
   276  alter table index07 add unique key idx1(col3);
   277  show index from index07;
   278  Table    Non_unique    Key_name    Seq_in_index    Column_name    Collation    Cardinality    Sub_part    Packed    Null    Index_type    Comment    Index_comment    Index_params    Visible    Expression
   279  index07    0    PRIMARY    1    col1    A    0    NULL    NULL                        YES    NULL
   280  index07    0    col3    1    col3    A    0    NULL    NULL                        YES    NULL
   281  index07    0    col3    2    col4    A    0    NULL    NULL                        YES    NULL
   282  index07    0    wwwww    1    col3    A    0    NULL    NULL                        YES    NULL
   283  index07    0    wwwww    2    col4    A    0    NULL    NULL                        YES    NULL
   284  index07    0    zxxxxx    1    col3    A    0    NULL    NULL                        YES    NULL
   285  index07    0    idx1    1    col3    A    0    NULL    NULL                        YES    NULL
   286  alter table index07 add constraint idx2 unique key (col3);
   287  alter table index07 add constraint idx2 unique key (col4);
   288  duplicate key name 'idx2'
   289  alter table index07 alter index wwwww invisible;
   290  show index from index07;
   291  Table    Non_unique    Key_name    Seq_in_index    Column_name    Collation    Cardinality    Sub_part    Packed    Null    Index_type    Comment    Index_comment    Index_params    Visible    Expression
   292  index07    0    PRIMARY    1    col1    A    0    NULL    NULL                        YES    NULL
   293  index07    0    col3    1    col3    A    0    NULL    NULL                        YES    NULL
   294  index07    0    col3    2    col4    A    0    NULL    NULL                        YES    NULL
   295  index07    0    zxxxxx    1    col3    A    0    NULL    NULL                        YES    NULL
   296  index07    0    idx1    1    col3    A    0    NULL    NULL                        YES    NULL
   297  index07    0    idx2    1    col3    A    0    NULL    NULL                        YES    NULL
   298  index07    0    wwwww    1    col3    A    0    NULL    NULL                        NO    NULL
   299  index07    0    wwwww    2    col4    A    0    NULL    NULL                        NO    NULL
   300  drop table index07;
   301  drop table if exists index08;
   302  CREATE TABLE index08(
   303  col1 INT NOT NULL,
   304  col2 DATE NOT NULL,
   305  col3 VARCHAR(16) NOT NULL,
   306  col4 int unsigned NOT NULL,
   307  PRIMARY KEY(col1)
   308  );
   309  insert into index08 values(1, '1980-12-17','Abby', 21);
   310  insert into index08 values(2, '1981-02-20','Bob', 22);
   311  alter table index08 add constraint unique index (col3, col4);
   312  alter table index08 add constraint index wwwww (col3, col4);
   313  SQL parser error: You have an error in your SQL syntax; check the manual that corresponds to your MatrixOne server version for the right syntax to use. syntax error at line 1 column 40 near " index wwwww (col3, col4);";
   314  alter table index08 add constraint unique index zxxxxx (col3);
   315  show index from index08;
   316  Table    Non_unique    Key_name    Seq_in_index    Column_name    Collation    Cardinality    Sub_part    Packed    Null    Index_type    Comment    Index_comment    Index_params    Visible    Expression
   317  index08    0    PRIMARY    1    col1    A    0    NULL    NULL                        YES    NULL
   318  index08    0    col3    1    col3    A    0    NULL    NULL                        YES    NULL
   319  index08    0    col3    2    col4    A    0    NULL    NULL                        YES    NULL
   320  index08    0    zxxxxx    1    col3    A    0    NULL    NULL                        YES    NULL
   321  alter table index08 add index zxxxx(col3);
   322  show index from index08;
   323  Table    Non_unique    Key_name    Seq_in_index    Column_name    Collation    Cardinality    Sub_part    Packed    Null    Index_type    Comment    Index_comment    Index_params    Visible    Expression
   324  index08    0    PRIMARY    1    col1    A    0    NULL    NULL                        YES    NULL
   325  index08    0    col3    1    col3    A    0    NULL    NULL                        YES    NULL
   326  index08    0    col3    2    col4    A    0    NULL    NULL                        YES    NULL
   327  index08    0    zxxxxx    1    col3    A    0    NULL    NULL                        YES    NULL
   328  index08    1    zxxxx    1    col3    A    0    NULL    NULL                        YES    NULL
   329  drop table index08;
   330  drop table if exists index09;
   331  CREATE TABLE index09(
   332  col1 INT NOT NULL,
   333  col2 DATE NOT NULL,
   334  col3 VARCHAR(16) NOT NULL,
   335  col4 int unsigned NOT NULL,
   336  UNIQUE KEY u1 (col1 DESC)
   337  );
   338  insert into index09 values(1, '1980-12-17','Abby', 21);
   339  insert into index09 values(2, '1981-02-20','Bob', 22);
   340  show index from index09;
   341  Table    Non_unique    Key_name    Seq_in_index    Column_name    Collation    Cardinality    Sub_part    Packed    Null    Index_type    Comment    Index_comment    Index_params    Visible    Expression
   342  index09    0    u1    1    col1    A    0    NULL    NULL                        YES    NULL
   343  ALTER TABLE emp ADD UNIQUE INDEX idx1 (col1 ASC, col2 DESC);
   344  no such table test.emp
   345  show index from index09;
   346  Table    Non_unique    Key_name    Seq_in_index    Column_name    Collation    Cardinality    Sub_part    Packed    Null    Index_type    Comment    Index_comment    Index_params    Visible    Expression
   347  index09    0    u1    1    col1    A    0    NULL    NULL                        YES    NULL
   348  drop table index09;
   349  drop table if exists index10;
   350  CREATE TABLE index10(
   351  col1 INT NOT NULL,
   352  col2 DATE NOT NULL,
   353  col3 VARCHAR(16) NOT NULL,
   354  col4 int unsigned NOT NULL,
   355  INDEX idx1 (col1 DESC),
   356  KEY idx2 (col2 DESC)
   357  );
   358  insert into index10 values(1, '1980-12-17','Abby', 21);
   359  insert into index10 values(2, '1981-02-20','Bob', 22);
   360  show index from index10;
   361  Table    Non_unique    Key_name    Seq_in_index    Column_name    Collation    Cardinality    Sub_part    Packed    Null    Index_type    Comment    Index_comment    Index_params    Visible    Expression
   362  index10    1    idx1    1    col1    A    0    NULL    NULL                        YES    NULL
   363  index10    1    idx2    1    col2    A    0    NULL    NULL                        YES    NULL
   364  ALTER TABLE emp ADD INDEX idx3 (col1 ASC, col2 DESC);
   365  no such table test.emp
   366  show index from index10;
   367  Table    Non_unique    Key_name    Seq_in_index    Column_name    Collation    Cardinality    Sub_part    Packed    Null    Index_type    Comment    Index_comment    Index_params    Visible    Expression
   368  index10    1    idx1    1    col1    A    0    NULL    NULL                        YES    NULL
   369  index10    1    idx2    1    col2    A    0    NULL    NULL                        YES    NULL
   370  drop table index10;
   371  CREATE TABLE `t2` (
   372  `a` INT DEFAULT NULL
   373  ) COMMENT='New table comment';
   374  alter table t2 drop primary key;
   375  Can't DROP 'PRIMARY'; check that column/key exists
   376  alter table t2 AUTO_INCREMENT=10;
   377  invalid input: Can't set AutoIncr column value.
   378  CREATE TABLE `t3` (
   379  `a` INT NOT NULL,
   380  PRIMARY KEY (`a`)
   381  );
   382  alter table t3 drop primary key;
   383  drop table if exists index03;
   384  create table index03(col1 int, col2 int, col3 int);
   385  insert into index03 values (1,2,1);
   386  insert into index03 values (2,3,4);
   387  insert into index03 values (1,2,10);
   388  select count(*) from index03;
   389  count(*)
   390  3
   391  alter table index03 add unique key `tempKey`(col1,col2) comment 'abcTest';
   392  Duplicate entry '(1,2)' for key '__mo_index_idx_col'
   393  show index from index03;
   394  Table    Non_unique    Key_name    Seq_in_index    Column_name    Collation    Cardinality    Sub_part    Packed    Null    Index_type    Comment    Index_comment    Index_params    Visible    Expression
   395  select count(*) from index03;
   396  count(*)
   397  3
   398  drop table index03;
   399  drop table if exists t4;
   400  create table t4(col1 varchar(256) primary key, col2 int);
   401  insert into t4 select "matrixone " || "mo " || result, 1 from generate_series (1, 500000)g;
   402  select count(*) from t4;
   403  count(*)
   404  500000
   405  alter table t4 add unique key `title01`(`col1`);
   406  show create table t4;
   407  Table    Create Table
   408  t4    CREATE TABLE `t4` (\n`col1` VARCHAR(256) NOT NULL,\n`col2` INT DEFAULT NULL,\nPRIMARY KEY (`col1`),\nUNIQUE KEY `title01` (`col1`)\n)
   409  select count(*) from t4;
   410  count(*)
   411  500000
   412  drop table t4;
   413  drop table if exists t5;
   414  create table t5(col1 varchar(256) primary key, col2 int);
   415  insert into t5 select "matrixone " || "mo " || result, 1 from generate_series (1, 500000)g;
   416  select count(*) from t5;
   417  count(*)
   418  500000
   419  alter table t5 add unique key `title01`(`col1`) using btree;
   420  show create table t5;
   421  Table    Create Table
   422  t5    CREATE TABLE `t5` (\n`col1` VARCHAR(256) NOT NULL,\n`col2` INT DEFAULT NULL,\nPRIMARY KEY (`col1`),\nUNIQUE KEY `title01` (`col1`)\n)
   423  select count(*) from t5;
   424  count(*)
   425  500000
   426  drop table t5;
   427  drop database test;
   428  drop database if exists `collate`;
   429  create database `collate`;
   430  use `collate`;
   431  drop table if exists t6;
   432  create table t6(col1 int, col2 int, col3 int);
   433  insert into t6 values (1,2,1);
   434  alter table t6 add unique key tempKey(col1,col2) comment 'abcTest';
   435  drop table t6;
   436  drop database `collate`;
   437  drop database if exists `current_time`;
   438  create database `current_time`;
   439  use `current_time`;
   440  drop table if exists t7;
   441  create table t7(col1 int, col2 int, col3 int);
   442  insert into t7 values (1,2,1);
   443  alter table t7 add unique index tempKey(col1,col2) comment 'unique index';
   444  drop table t7;
   445  drop database `current_time`;
   446  drop database if exists `drop`;
   447  create database `drop`;
   448  use `drop`;
   449  drop table if exists t8;
   450  create table t8(col1 char, col2 int, col3 binary);
   451  insert into t8 values('a', 33, 1);
   452  insert into t8 values('c', 231, 0);
   453  alter table t8 add key pk(col1) comment 'primary key';
   454  select * from t8;
   455  col1    col2    col3
   456  a    33    1
   457  c    231    0
   458  drop table t8;
   459  drop database `drop`;