@@ -48,7 +48,7 @@ public static SQLQueryAdapter getQuery(TiDBGlobalState globalState) {
4848 throw new IgnoreMeException ();
4949 }
5050 sb .append (column .getName ());
51- errors .add ("with index covered now" );
51+ errors .add ("with composite index covered or Primary Key covered now" );
5252 errors .add ("Unsupported drop integer primary key" );
5353 errors .add ("has a generated column dependency" );
5454 errors .add (
@@ -67,15 +67,27 @@ public static SQLQueryAdapter getQuery(TiDBGlobalState globalState) {
6767 }
6868 errors .add ("Unsupported drop integer primary key" );
6969 errors .add ("Unsupported drop primary key when alter-primary-key is false" );
70+ errors .add ("Unsupported drop primary key when the table's pkIsHandle is true" );
71+ errors .add ("Incorrect table definition; there can be only one auto column and it must be defined as a key" );
7072 sb .append (" DROP PRIMARY KEY" );
7173 break ;
7274 case ADD_PRIMARY_KEY :
7375 sb .append ("ADD PRIMARY KEY(" );
74- sb .append (table .getRandomNonEmptyColumnSubset ().stream ().map (c -> c .getName ())
75- .collect (Collectors .joining (", " )));
76+ sb .append (table .getRandomNonEmptyColumnSubset ().stream ().map (c -> {
77+ StringBuilder colName = new StringBuilder (c .getName ());
78+ if (c .getType ().getPrimitiveDataType () == TiDBDataType .TEXT
79+ || c .getType ().getPrimitiveDataType () == TiDBDataType .BLOB ) {
80+ TiDBTableGenerator .appendSpecifiers (colName , c .getType ().getPrimitiveDataType ());
81+ }
82+ return colName ;
83+ }).collect (Collectors .joining (", " )));
7684 sb .append (")" );
7785 errors .add ("Unsupported add primary key, alter-primary-key is false" );
7886 errors .add ("Information schema is changed during the execution of the statement" );
87+ errors .add ("Multiple primary key defined" );
88+ errors .add ("Invalid use of NULL value" );
89+ errors .add ("Duplicate entry" );
90+ errors .add ("'Defining a virtual generated column as primary key' is not supported for generated columns" );
7991 break ;
8092 case CHANGE :
8193 if (TiDBBugs .bug10 ) {
@@ -101,7 +113,6 @@ public static SQLQueryAdapter getQuery(TiDBGlobalState globalState) {
101113 default :
102114 throw new AssertionError (a );
103115 }
104-
105116 return new SQLQueryAdapter (sb .toString (), errors , true );
106117 }
107118
0 commit comments