github.com/pingcap/tiflow@v0.0.0-20240520035814-5bf52d54e205/tests/integration_tests/tidb_mysql_test/t/composite_index.test (about)

     1  DROP TABLE IF EXISTS t;
     2  
     3  # create table
     4  CREATE TABLE t (c1 int, c2 integer, c3 int, c4 int, primary key(c1));
     5  
     6  # insert data
     7  INSERT INTO t (c1, c2, c3) VALUES(11, 22, 33);
     8  --error Condition not match
     9  INSERT INTO t (c1, c2, c3) VALUES(11, 22, 33);
    10  
    11  #composite primary key
    12  #DROP TABLE IF EXISTS t;
    13  
    14  # create table
    15  CREATE TABLE t1 (c1 int, c2 int, c3 int, c4 int, primary key(c1, c2));
    16  
    17  # insert data
    18  INSERT INTO t1 (c1, c2, c3) VALUES(11, 22, 33);
    19  INSERT INTO t1 (c1, c2, c3) VALUES(11, 21, 33);
    20  --error Condition not match
    21  INSERT INTO t1 (c1, c2, c3) VALUES(11, 22, 44);
    22  
    23  #composite unique key
    24  #DROP TABLE IF EXISTS t;
    25  # create table
    26  CREATE TABLE t2 (c1 int, c2 int, c3 int, UNIQUE c1_c2 (c1, c2));
    27  # insert data
    28  INSERT INTO t2 (c1, c2, c3) VALUES(11, 22, 33);
    29  INSERT INTO t2 (c1, c2, c3) VALUES(11, 21, 33);
    30  --error Condition not match
    31  INSERT INTO t2 (c1, c2, c3) VALUES(11, 22, 44);