mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-18 05:32:52 +00:00
Add functional tests for create_table_empty_primary_key_by_default
1. 02902_empty_order_by_throws_error - setting disabled and no order by or primary key - expect error - setting disabled and primary key in the table definition - no error and expect order by as primary key 2. 02903_empty_order_by_with_setting_enabled - setting enabled and no order by or primary key - expect the order by as empty - setting enabled and per-column primary key - expect the order by as column order - setting enabled and primary key in table definition (not per-column or order by) - expect order as primary key - setting enabled and order by in table definition (no primary key) - expect same order by
This commit is contained in:
parent
eb959a1e08
commit
3f9ffbb451
@ -0,0 +1,2 @@
|
||||
OK
|
||||
OK
|
18
tests/queries/0_stateless/02902_empty_order_by_throws_error.sh
Executable file
18
tests/queries/0_stateless/02902_empty_order_by_throws_error.sh
Executable file
@ -0,0 +1,18 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
CUR_DIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
|
||||
# shellcheck source=../shell_config.sh
|
||||
. "$CUR_DIR"/../shell_config.sh
|
||||
|
||||
# setting disabled and no order by or primary key; expect error
|
||||
$CLICKHOUSE_CLIENT -n --query="
|
||||
DROP TABLE IF EXISTS test_empty_order_by;
|
||||
CREATE TABLE test_empty_order_by(a UInt8) ENGINE = MergeTree() SETTINGS index_granularity = 8192;
|
||||
" 2>&1 \ | grep -F -q "You must provide an ORDER BY or PRIMARY KEY expression in the table definition." && echo 'OK' || echo 'FAIL'
|
||||
|
||||
# setting disabled and primary key in table definition
|
||||
$CLICKHOUSE_CLIENT -n --query="
|
||||
DROP TABLE IF EXISTS test_empty_order_by;
|
||||
CREATE TABLE test_empty_order_by(a UInt8) ENGINE = MergeTree() PRIMARY KEY a SETTINGS index_granularity = 8192;
|
||||
SHOW CREATE TABLE test_empty_order_by;
|
||||
" 2>&1 \ | grep -F -q "ORDER BY a" && echo 'OK' || echo 'FAIL'
|
@ -0,0 +1,4 @@
|
||||
OK
|
||||
OK
|
||||
OK
|
||||
OK
|
37
tests/queries/0_stateless/02903_empty_order_by_with_setting_enabled.sh
Executable file
37
tests/queries/0_stateless/02903_empty_order_by_with_setting_enabled.sh
Executable file
@ -0,0 +1,37 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
CUR_DIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
|
||||
# shellcheck source=../shell_config.sh
|
||||
. "$CUR_DIR"/../shell_config.sh
|
||||
|
||||
# setting enabled and no order by or primary key
|
||||
${CLICKHOUSE_CLIENT} -n --query="
|
||||
SET create_table_empty_primary_key_by_default = true;
|
||||
DROP TABLE IF EXISTS test_empty_order_by;
|
||||
CREATE TABLE test_empty_order_by(a UInt8) ENGINE = MergeTree() SETTINGS index_granularity = 8192;
|
||||
SHOW CREATE TABLE test_empty_order_by;
|
||||
" 2>&1 \ | grep -F -q "ORDER BY tuple()" && echo 'OK' || echo 'FAIL'
|
||||
|
||||
# setting enabled and per-column primary key
|
||||
${CLICKHOUSE_CLIENT} -n --query="
|
||||
SET create_table_empty_primary_key_by_default = true;
|
||||
DROP TABLE IF EXISTS test_empty_order_by;
|
||||
CREATE TABLE test_empty_order_by(a UInt8 PRIMARY KEY, b String PRIMARY KEY) ENGINE = MergeTree() SETTINGS index_granularity = 8192;
|
||||
SHOW CREATE TABLE test_empty_order_by;
|
||||
" 2>&1 \ | grep -F -q "ORDER BY (a, b)" && echo 'OK' || echo 'FAIL'
|
||||
|
||||
# setting enabled and primary key in table definition (not per-column or order by)
|
||||
${CLICKHOUSE_CLIENT} -n --query="
|
||||
SET create_table_empty_primary_key_by_default = true;
|
||||
DROP TABLE IF EXISTS test_empty_order_by;
|
||||
CREATE TABLE test_empty_order_by(a UInt8, b String) ENGINE = MergeTree() PRIMARY KEY (a) SETTINGS index_granularity = 8192;
|
||||
SHOW CREATE TABLE test_empty_order_by;
|
||||
" 2>&1 \ | grep -F -q "ORDER BY a" && echo 'OK' || echo 'FAIL'
|
||||
|
||||
# setting enabled and order by in table definition (no primary key)
|
||||
${CLICKHOUSE_CLIENT} -n --query="
|
||||
SET create_table_empty_primary_key_by_default = true;
|
||||
DROP TABLE IF EXISTS test_empty_order_by;
|
||||
CREATE TABLE test_empty_order_by(a UInt8, b String) ENGINE = MergeTree() ORDER BY (a, b) SETTINGS index_granularity = 8192;
|
||||
SHOW CREATE TABLE test_empty_order_by;
|
||||
" 2>&1 \ | grep -F -q "ORDER BY (a, b)" && echo 'OK' || echo 'FAIL'
|
Loading…
Reference in New Issue
Block a user