Quellcodebibliothek Statistik Leitseite products/Sources/formale Sprachen/C/MariaDB/storage/rocksdb/mysql-test/rocksdb/t/   (MariaDB Server Version 8.1-8.4©)  Datei vom 1.9.2026 mit Größe 1 kB image not shown  

Quelle  replace.test  Sprache: unbekannt

 
Spracherkennung für: .test vermutete Sprache: SQL {SQL[140] VDM[60] Lisp[35]} [Methode: maximale Elemente, drei Dimensionen]

--source include/have_rocksdb.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=rocksdb;

# 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_parsing

CREATE TABLE t1 (a INT, b CHAR(8), pk INT AUTO_INCREMENT PRIMARY KEY, UNIQUE INDEX (a)) ENGINE=rocksdb;
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_parsing

CREATE TABLE t1 (a INT, b CHAR(8), PRIMARY KEY (b)) ENGINE=rocksdb;
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;


[Dauer der Verarbeitung: 0.14 Sekunden, vorverarbeitet 2026-10-08]