ClickHouse/tests/queries/0_stateless/01686_rocksdb.sql
Azat Khuzhin c7d2a5aad8 Add system.rocksdb table (with various rocksdb internals)
v2: fix USE_ROCKSDB check (there is #cmakedefine01 so it is either 0/1,
so we should not check with #ifdef)
2021-07-26 23:13:59 +03:00

29 lines
1.1 KiB
SQL

DROP TABLE IF EXISTS 01686_test;
CREATE TABLE 01686_test (key UInt64, value String) Engine=EmbeddedRocksDB PRIMARY KEY(key);
SELECT value FROM system.rocksdb WHERE database = currentDatabase() and table = '01686_test' and name = 'number.keys.written';
INSERT INTO 01686_test SELECT number, format('Hello, world ({})', toString(number)) FROM numbers(10000);
SELECT value FROM system.rocksdb WHERE database = currentDatabase() and table = '01686_test' and name = 'number.keys.written';
SELECT * FROM 01686_test WHERE key = 123;
SELECT '--';
SELECT * FROM 01686_test WHERE key = -123;
SELECT '--';
SELECT * FROM 01686_test WHERE key = 123 OR key = 4567 ORDER BY key;
SELECT '--';
SELECT * FROM 01686_test WHERE key = NULL;
SELECT '--';
SELECT * FROM 01686_test WHERE key = NULL OR key = 0;
SELECT '--';
SELECT * FROM 01686_test WHERE key IN (123, 456, -123) ORDER BY key;
SELECT '--';
SELECT * FROM 01686_test WHERE key = 'Hello'; -- { serverError 53 }
DETACH TABLE 01686_test NO DELAY;
ATTACH TABLE 01686_test;
SELECT * FROM 01686_test WHERE key IN (99, 999, 9999, -123) ORDER BY key;
DROP TABLE IF EXISTS 01686_test;