ClickHouse/tests/queries/0_stateless/00595_insert_into_view.sh

21 lines
954 B
Bash
Raw Normal View History

2018-03-01 14:49:16 +00:00
#!/usr/bin/env bash
CURDIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
2020-12-28 11:46:53 +00:00
# shellcheck source=../shell_config.sh
2020-08-01 00:51:12 +00:00
. "$CURDIR"/../shell_config.sh
2018-03-01 14:49:16 +00:00
exception_pattern="Code: 48.*Method write is not supported by storage View"
2019-06-03 17:36:27 +00:00
${CLICKHOUSE_CLIENT} --query "DROP TABLE IF EXISTS test_00595;"
${CLICKHOUSE_CLIENT} --query "DROP TABLE IF EXISTS test_view_00595;"
2018-03-01 14:49:16 +00:00
2019-06-03 17:36:27 +00:00
${CLICKHOUSE_CLIENT} --query "CREATE TABLE test_00595 (s String) ENGINE = Log;"
${CLICKHOUSE_CLIENT} --query "CREATE VIEW test_view_00595 AS SELECT * FROM test_00595;"
2018-03-01 14:49:16 +00:00
(( $(${CLICKHOUSE_CLIENT} --query "INSERT INTO test_view_00595 VALUES('test_string');" 2>&1 | grep -c "$exception_pattern") >= 1 )) && echo 1 || echo "NO MATCH"
2019-06-03 17:36:27 +00:00
${CLICKHOUSE_CLIENT} --query "INSERT INTO test_00595 VALUES('test_string');"
${CLICKHOUSE_CLIENT} --query "SELECT * FROM test_00595;"
2018-03-01 14:49:16 +00:00
2019-06-03 17:36:27 +00:00
${CLICKHOUSE_CLIENT} --query "DROP TABLE IF EXISTS test_00595;"
${CLICKHOUSE_CLIENT} --query "DROP TABLE IF EXISTS test_view_00595;"