github.com/pingcap/tiflow@v0.0.0-20240520035814-5bf52d54e205/tests/integration_tests/tidb_mysql_test/t/mysql_replace.test (about) 1 # 2 # Test of REPLACE with MyISAM and HEAP 3 # 4 5 --disable_warnings 6 drop table if exists t1; 7 --enable_warnings 8 9 CREATE TABLE t1 ( 10 gesuchnr int(11) DEFAULT '0' NOT NULL, 11 benutzer_id int(11) DEFAULT '0' NOT NULL, 12 PRIMARY KEY (gesuchnr,benutzer_id) 13 ); 14 15 replace into t1 (gesuchnr,benutzer_id) values (2,1); 16 replace into t1 (gesuchnr,benutzer_id) values (1,1); 17 replace into t1 (gesuchnr,benutzer_id) values (1,1); 18 --error ErrUnsupportedDDLOperation 19 alter table t1 engine=heap; 20 replace into t1 (gesuchnr,benutzer_id) values (1,1); 21 #drop table t1; 22 23 # 24 # Test when using replace on a key that has used up it's whole range 25 # 26 SET sql_mode = 'NO_ENGINE_SUBSTITUTION'; 27 create table t2 (a tinyint not null auto_increment primary key, b char(20) default "default_value"); 28 insert into t2 values (126,"first"),(63, "middle"),(0,"last"); 29 # MySQL reports ER_DUP_ENTRY but TiDB reports ErrAutoincReadFailed. 30 --error ErrAutoincReadFailed 31 insert into t2 values (0,"error"); 32 # MySQL reports ER_DUP_ENTRY but TiDB reports ErrAutoincReadFailed. 33 --error ErrAutoincReadFailed 34 replace into t2 values (0,"last updated"); 35 replace into t2 values (126,"first updated"); 36 replace into t2 values (63,default); 37 select * from t2; 38 #drop table t1; 39 SET sql_mode = default; 40 # End of 4.1 tests 41 42 # 43 # Bug#19789: REPLACE was allowed for a VIEW with CHECK OPTION enabled. 44 # 45 #CREATE TABLE t1 (f1 INT); 46 #CREATE VIEW v1 AS SELECT f1 FROM t1 WHERE f1 = 0 WITH CHECK OPTION; 47 #--error 1369 48 #REPLACE INTO v1 (f1) VALUES (1); 49 #DROP TABLE t1; 50 #DROP VIEW v1;