ClickHouse/tests/queries/0_stateless/02030_client_unknown_database.sh
Azat Khuzhin b3d1bfc67a Send UNKNOWN_DATABASE to the client (via TCP)
Before this patch:

    $ clickhouse-client --database foo -q 'select 1'
    Code: 32. DB::Exception: Attempt to read after eof: while receiving packet from localhost:9000. (ATTEMPT_TO_READ_AFTER_EOF)

After:

    $ clickhouse-client --database foo -q 'select 1'
    Received exception from server (version 21.11.1):
    Code: 81. DB::Exception: Received from localhost:9000. DB::Exception: Database foo doesn't exist. (UNKNOWN_DATABASE)
    (query: select 1)

Fixes: #26864 (cc @vitlibar)
2021-09-26 23:45:29 +03:00

10 lines
256 B
Bash
Executable File

#!/usr/bin/env bash
CLICKHOUSE_DATABASE=no_such_database_could_exist
CURDIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
# shellcheck source=../shell_config.sh
. "$CURDIR"/../shell_config.sh
$CLICKHOUSE_CLIENT -q "SELECT 1" |& grep -q UNKNOWN_DATABASE