ClickHouse/tests/queries/0_stateless/02181_dictionary_attach_detach.sql
2024-05-30 19:41:08 +00:00

40 lines
939 B
SQL

DROP TABLE IF EXISTS 02181_test_table;
CREATE TABLE 02181_test_table
(
id UInt64,
value String
)
ENGINE = TinyLog;
INSERT INTO 02181_test_table VALUES (0, 'Value');
DROP DICTIONARY IF EXISTS 02181_test_dictionary;
CREATE DICTIONARY 02181_test_dictionary
(
id UInt64,
value String
)
PRIMARY KEY id
SOURCE(CLICKHOUSE(TABLE '02181_test_table'))
LAYOUT(HASHED())
LIFETIME(0);
DETACH TABLE 02181_test_dictionary; --{serverError CANNOT_DETACH_DICTIONARY_AS_TABLE}
ATTACH TABLE 02181_test_dictionary; --{serverError INCORRECT_QUERY}
DETACH DICTIONARY 02181_test_dictionary;
ATTACH DICTIONARY 02181_test_dictionary;
SELECT * FROM 02181_test_dictionary;
DETACH DICTIONARY 02181_test_dictionary;
ATTACH DICTIONARY 02181_test_dictionary;
SELECT * FROM 02181_test_dictionary;
DETACH DICTIONARY 02181_test_dictionary;
ATTACH DICTIONARY 02181_test_dictionary;
DROP DICTIONARY 02181_test_dictionary;
DROP TABLE 02181_test_table;