mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-24 00:22:29 +00:00
c5ffbc688e
Parsing SETTINGS after FORMAT, that has been introduced in [1], can interpret SETTING as some values, which is misleading. [1]: https://github.com/ClickHouse/ClickHouse/pull/4174/files#diff-ba7bd0657630b1cd94cf6ed364bd857338096f49f66dc82918438d6745753775R106 Note, that we are touching only INSERT queries, not SELECT, since this is a backward incompatible change, and in case of modifying SELECT it can break too much. Signed-off-by: Azat Khuzhin <a.khuzhin@semrush.com> Fixes: #35100 Fixes: #20343
37 lines
1.6 KiB
Bash
Executable File
37 lines
1.6 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
CURDIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
|
|
# shellcheck source=../shell_config.sh
|
|
. "$CURDIR"/../shell_config.sh
|
|
|
|
$CLICKHOUSE_CLIENT --query="DROP TABLE IF EXISTS custom_separated"
|
|
$CLICKHOUSE_CLIENT --query="CREATE TABLE custom_separated (n UInt64, d Date, s String) ENGINE = Memory()"
|
|
$CLICKHOUSE_CLIENT --query="INSERT INTO custom_separated VALUES (0, '2019-09-24', 'hello'), (1, '2019-09-25', 'world'), (2, '2019-09-26', 'custom'), (3, '2019-09-27', 'separated')"
|
|
|
|
$CLICKHOUSE_CLIENT --query="SELECT * FROM custom_separated ORDER BY n FORMAT CustomSeparated SETTINGS \
|
|
format_custom_escaping_rule = 'CSV', \
|
|
format_custom_field_delimiter = '\t|\t', \
|
|
format_custom_row_before_delimiter = '||', \
|
|
format_custom_row_after_delimiter = '\t||', \
|
|
format_custom_row_between_delimiter = '\n', \
|
|
format_custom_result_before_delimiter = '========== result ==========\n', \
|
|
format_custom_result_after_delimiter = '\n============================\n'"
|
|
|
|
$CLICKHOUSE_CLIENT --query="TRUNCATE TABLE custom_separated"
|
|
|
|
echo '0, "2019-09-24", "hello"
|
|
1, 2019-09-25, "world"
|
|
2, "2019-09-26", custom
|
|
3, 2019-09-27, separated
|
|
end' | $CLICKHOUSE_CLIENT --query="INSERT INTO custom_separated SETTINGS \
|
|
format_custom_escaping_rule = 'CSV', \
|
|
format_custom_field_delimiter = ', ', \
|
|
format_custom_row_after_delimiter = '\n', \
|
|
format_custom_row_between_delimiter = '', \
|
|
format_custom_result_after_delimiter = 'end\n'
|
|
FORMAT CustomSeparated"
|
|
|
|
$CLICKHOUSE_CLIENT --query="SELECT * FROM custom_separated ORDER BY n FORMAT CSV"
|
|
|
|
$CLICKHOUSE_CLIENT --query="DROP TABLE custom_separated"
|