polardbxengine/mysql-test/suite/xengine/t/replace.test

56 lines
1.3 KiB
Plaintext

--source suite/xengine/include/have_xengine.inc
#
# Basic REPLACE statements
#
###########################################
# TODO:
# A part of the test is currently disabled
# because unique indexes are not supported
###########################################
--disable_warnings
DROP TABLE IF EXISTS t1;
--enable_warnings
CREATE TABLE t1 (a INT, b CHAR(8), pk INT AUTO_INCREMENT PRIMARY KEY) ENGINE=xengine;
# When there is no duplicate key, REPLACE should work as INSERT
REPLACE INTO t1 (a,b) VALUES (1,'a'),(2,'b'),(3,'c'),(4,'d'),(5,'e');
--sorted_result
SELECT a,b FROM t1;
REPLACE t1 (a,b) VALUE (10,'foo'),(10,'foo');
--sorted_result
SELECT a,b FROM t1;
DROP TABLE t1;
--disable_testcase BUG#0
CREATE TABLE t1 (a INT, b CHAR(8), pk INT AUTO_INCREMENT PRIMARY KEY, UNIQUE INDEX (a)) ENGINE=xengine;
REPLACE INTO t1 (a,b) VALUES (1,'a'),(2,'b'),(3,'c');
--error ER_DUP_ENTRY
INSERT INTO t1 (a,b) VALUES (2,'d');
REPLACE INTO t1 (a,b) VALUES (2,'d');
--sorted_result
SELECT a,b FROM t1;
DROP TABLE t1;
--enable_testcase
CREATE TABLE t1 (a INT, b CHAR(8), PRIMARY KEY (b)) ENGINE=xengine;
REPLACE INTO t1 (a,b) VALUES (1,'a'),(2,'b'),(3,'c');
--error ER_DUP_ENTRY
INSERT INTO t1 (a,b) VALUES (4,'b');
REPLACE INTO t1 (a,b) VALUES (4,'b');
--sorted_result
SELECT a,b FROM t1;
DROP TABLE t1;
--source suite/xengine/include/check_xengine_log_error.inc