2019-06-03 21:08:52 +00:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
|
|
CURDIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
|
2020-08-01 00:51:12 +00:00
|
|
|
. "$CURDIR"/../shell_config.sh
|
2019-06-03 21:08:52 +00:00
|
|
|
|
|
|
|
EXCEPTION_SUCCESS_TEXT=ok
|
|
|
|
|
|
|
|
$CLICKHOUSE_CLIENT --query="DROP TABLE IF EXISTS test_drop_indices;"
|
|
|
|
|
|
|
|
$CLICKHOUSE_CLIENT --query="CREATE TABLE test_drop_indices
|
|
|
|
(
|
|
|
|
a UInt32,
|
|
|
|
b UInt32
|
|
|
|
)
|
|
|
|
ENGINE = MergeTree ORDER BY (a);"
|
|
|
|
|
2019-06-03 21:12:36 +00:00
|
|
|
# Must throw an exception
|
2019-06-03 21:08:52 +00:00
|
|
|
EXCEPTION_TEXT="Cannot find index \`test_index\` to drop.."
|
|
|
|
$CLICKHOUSE_CLIENT --query="ALTER TABLE test_drop_indices DROP INDEX test_index;" 2>&1 \
|
|
|
|
| grep -q "$EXCEPTION_TEXT" && echo "$EXCEPTION_SUCCESS_TEXT" || echo "Did not thrown an exception"
|
|
|
|
|
|
|
|
# Must not throw an exception
|
|
|
|
$CLICKHOUSE_CLIENT --query="ALTER TABLE test_drop_indices DROP INDEX IF EXISTS test_index"
|
|
|
|
|
2019-06-04 10:36:54 +00:00
|
|
|
$CLICKHOUSE_CLIENT --query="DROP TABLE test_drop_indices;"
|
|
|
|
|