Merge pull request #11706 from ClickHouse/add_column_check

Add column if not exists tests
This commit is contained in:
alesapin 2020-06-17 20:09:57 +03:00 committed by GitHub
commit ac93f2795c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 31 additions and 0 deletions

View File

@ -0,0 +1,4 @@
CREATE TABLE default.add_table\n(\n `key` UInt64,\n `value1` String\n)\nENGINE = MergeTree()\nORDER BY key\nSETTINGS index_granularity = 8192
CREATE TABLE default.add_table\n(\n `key` UInt64,\n `value1` String\n)\nENGINE = MergeTree()\nORDER BY key\nSETTINGS index_granularity = 8192
CREATE TABLE default.add_table\n(\n `key` UInt64,\n `value1` String\n)\nENGINE = MergeTree()\nORDER BY key\nSETTINGS index_granularity = 8192
CREATE TABLE default.add_table\n(\n `key` UInt64,\n `value1` String,\n `value2` UInt64\n)\nENGINE = MergeTree()\nORDER BY key\nSETTINGS index_granularity = 8192

View File

@ -0,0 +1,27 @@
DROP TABLE IF EXISTS add_table;
CREATE TABLE add_table
(
key UInt64,
value1 String
)
ENGINE = MergeTree()
ORDER BY key;
SHOW CREATE TABLE add_table;
ALTER TABLE add_table ADD COLUMN IF NOT EXISTS value1 UInt64;
SHOW CREATE TABLE add_table;
ALTER TABLE add_table ADD COLUMN IF NOT EXISTS key String, ADD COLUMN IF NOT EXISTS value1 UInt64;
SHOW CREATE TABLE add_table;
ALTER TABLE add_table ADD COLUMN IF NOT EXISTS value1 UInt64, ADD COLUMN IF NOT EXISTS value2 UInt64;
SHOW CREATE TABLE add_table;
ALTER TABLE add_table ADD COLUMN value3 UInt64, ADD COLUMN IF NOT EXISTS value3 UInt32; --{serverError 44}
DROP TABLE IF EXISTS add_table;