From 2c86b251dec91e9f0c6a5e61f5d565d907da94e6 Mon Sep 17 00:00:00 2001 From: Bharat Nallan Chakravarthy Date: Tue, 28 Nov 2023 21:26:34 -0800 Subject: [PATCH] add a test --- ...ter_hint_when_table_doesnt_exist.reference | 6 ++++++ ...931_better_hint_when_table_doesnt_exist.sh | 19 +++++++++++++++++++ 2 files changed, 25 insertions(+) create mode 100644 tests/queries/0_stateless/02931_better_hint_when_table_doesnt_exist.reference create mode 100755 tests/queries/0_stateless/02931_better_hint_when_table_doesnt_exist.sh diff --git a/tests/queries/0_stateless/02931_better_hint_when_table_doesnt_exist.reference b/tests/queries/0_stateless/02931_better_hint_when_table_doesnt_exist.reference new file mode 100644 index 00000000000..afa237277f3 --- /dev/null +++ b/tests/queries/0_stateless/02931_better_hint_when_table_doesnt_exist.reference @@ -0,0 +1,6 @@ +OK +OK +OK +OK +OK +OK diff --git a/tests/queries/0_stateless/02931_better_hint_when_table_doesnt_exist.sh b/tests/queries/0_stateless/02931_better_hint_when_table_doesnt_exist.sh new file mode 100755 index 00000000000..edd076fb458 --- /dev/null +++ b/tests/queries/0_stateless/02931_better_hint_when_table_doesnt_exist.sh @@ -0,0 +1,19 @@ +#!/usr/bin/env bash + +CURDIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd) +# shellcheck source=../shell_config.sh +. "$CURDIR"/../shell_config.sh + +$CLICKHOUSE_CLIENT -q "DROP DATABASE IF EXISTS test_02931;" +$CLICKHOUSE_CLIENT -q "CREATE DATABASE test_02931;" +$CLICKHOUSE_CLIENT -q "SELECT * FROM test_02931.query_log;" 2>&1 | grep -q "Table test_02931.query_log does not exist" && echo 'OK' || echo 'FAIL' +$CLICKHOUSE_CLIENT -q "SELECT * FROM test_02931.query_log;" 2>&1 | grep -q " Maybe you meant system.query_log?" && echo 'OK' || echo 'FAIL' + +$CLICKHOUSE_CLIENT -q "SELECT * FROM test_02931.foo_bar;" 2>&1 | grep -q "Table test_02931.foo_bar does not exist" && echo 'OK' || echo 'FAIL' +$CLICKHOUSE_CLIENT -q "SELECT * FROM test_02931.foo_bar;" 2>&1 | grep " Maybe you meant system.foo_bar?" && echo 'FAIL' || echo 'OK' + +$CLICKHOUSE_CLIENT -q "SELECT * FROM system.querylog;" 2>&1 | grep -q " Maybe you meant system.query_log?" && echo 'OK' || echo 'FAIL' +$CLICKHOUSE_CLIENT -q "SELECT * FROM querylog;" 2>&1 | grep -q " Maybe you meant system.query_log?" && echo 'OK' || echo 'FAIL' + + +$CLICKHOUSE_CLIENT -q "DROP DATABASE test_02931;"