ClickHouse/tests/queries/0_stateless/01017_tsv_empty_as_default.sh

16 lines
701 B
Bash
Raw Normal View History

2019-10-07 16:08:07 +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
2019-10-07 16:08:07 +00:00
$CLICKHOUSE_CLIENT --query="DROP TABLE IF EXISTS empty_as_default";
$CLICKHOUSE_CLIENT --query="CREATE TABLE empty_as_default (s String, n UInt64 DEFAULT 1, d Date DEFAULT '2019-06-19') ENGINE = Memory";
echo -ne 'abcd\t100\t2016-01-01
default\t\t
\t\t
2019-10-16 14:22:22 +00:00
default-eof\t\t' | $CLICKHOUSE_CLIENT --input_format_defaults_for_omitted_fields=1 --input_format_tsv_empty_as_default=1 --query="INSERT INTO empty_as_default FORMAT TSV";
2019-10-07 16:08:07 +00:00
$CLICKHOUSE_CLIENT --query="SELECT * FROM empty_as_default ORDER BY s";
$CLICKHOUSE_CLIENT --query="DROP TABLE empty_as_default";