From 699669b81d6bdb335979787afa9fb9769f7da3fa Mon Sep 17 00:00:00 2001 From: Andrii Buriachevskyi Date: Wed, 5 Jan 2022 19:17:25 +0100 Subject: [PATCH] Add tests for INSERT DEFAULT with format Values --- ...02155_default_keyword_format_values.reference | 8 ++++++++ .../02155_default_keyword_format_values.sh | 16 ++++++++++++++++ 2 files changed, 24 insertions(+) create mode 100644 tests/queries/0_stateless/02155_default_keyword_format_values.reference create mode 100755 tests/queries/0_stateless/02155_default_keyword_format_values.sh diff --git a/tests/queries/0_stateless/02155_default_keyword_format_values.reference b/tests/queries/0_stateless/02155_default_keyword_format_values.reference new file mode 100644 index 00000000000..022aeaff0a9 --- /dev/null +++ b/tests/queries/0_stateless/02155_default_keyword_format_values.reference @@ -0,0 +1,8 @@ +0 1 33 +0 42 33 +1 42 2 +2 42 33 +3 42 3 +4 42 3 +5 42 33 +6 6 33 diff --git a/tests/queries/0_stateless/02155_default_keyword_format_values.sh b/tests/queries/0_stateless/02155_default_keyword_format_values.sh new file mode 100755 index 00000000000..53f88747fdc --- /dev/null +++ b/tests/queries/0_stateless/02155_default_keyword_format_values.sh @@ -0,0 +1,16 @@ +#!/usr/bin/env bash + +CURDIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd) +# shellcheck source=../shell_config.sh +. "$CURDIR"/../shell_config.sh + +$CLICKHOUSE_CLIENT -q "CREATE TABLE IF NOT EXISTS default_table (x UInt32, y UInt32 DEFAULT 42, z UInt32 DEFAULT 33) ENGINE = Memory;" + +echo "(DEFAULT, 1, DEFAULT), (1, DEFAULT, 2)" | $CLICKHOUSE_CLIENT --input_format_values_interpret_expressions=0 -q "INSERT INTO default_table FORMAT Values" +echo "(2, DEFAULT), (3, 3)" | $CLICKHOUSE_CLIENT --input_format_values_interpret_expressions=0 -q "INSERT INTO default_table(x, z) FORMAT Values" + +echo "(DEFAULT, DEFAULT, DEFAULT), (4, DEFAULT, 3)" | $CLICKHOUSE_CLIENT --input_format_values_interpret_expressions=1 -q "INSERT INTO default_table FORMAT Values" +echo "(5, DEFAULT), (6, 6)" | $CLICKHOUSE_CLIENT --input_format_values_interpret_expressions=1 -q "INSERT INTO default_table(x, y) FORMAT Values" + +$CLICKHOUSE_CLIENT --query="SELECT * FROM default_table ORDER BY x, y"; +$CLICKHOUSE_CLIENT --query="DROP TABLE default_table"