mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-13 11:04:10 +00:00
Merge pull request #46232 from aiven-sal/aiven-sal/format
ASTFunction: never rewrite tuple function as literal when formatting
This commit is contained in:
commit
c6dc39f9e2
@ -1019,7 +1019,8 @@ void ASTFunction::formatImplWithoutAlias(const FormatSettings & settings, Format
|
||||
|
||||
if (!written && arguments->children.size() >= 2 && name == "tuple"sv)
|
||||
{
|
||||
settings.ostr << (settings.hilite ? hilite_operator : "") << '(' << (settings.hilite ? hilite_none : "");
|
||||
settings.ostr << (settings.hilite ? hilite_operator : "") << ((frame.need_parens && !alias.empty()) ? "tuple" : "") << '('
|
||||
<< (settings.hilite ? hilite_none : "");
|
||||
for (size_t i = 0; i < arguments->children.size(); ++i)
|
||||
{
|
||||
if (i != 0)
|
||||
|
4
tests/queries/0_stateless/02560_tuple_format.reference
Normal file
4
tests/queries/0_stateless/02560_tuple_format.reference
Normal file
@ -0,0 +1,4 @@
|
||||
SELECT (1, 2, 3)
|
||||
SELECT (1, 2, 3) AS x
|
||||
SELECT (1, 2, 3).1
|
||||
SELECT (tuple(1, 2, 3) AS x).1
|
10
tests/queries/0_stateless/02560_tuple_format.sh
Executable file
10
tests/queries/0_stateless/02560_tuple_format.sh
Executable file
@ -0,0 +1,10 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
CUR_DIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
|
||||
# shellcheck source=../shell_config.sh
|
||||
. "$CUR_DIR"/../shell_config.sh
|
||||
|
||||
echo "select (tuple(1, 2, 3));" | "$CLICKHOUSE_FORMAT"
|
||||
echo "select (tuple(1, 2, 3) as x);" | "$CLICKHOUSE_FORMAT"
|
||||
echo "select (tuple(1, 2, 3)).1;" | "$CLICKHOUSE_FORMAT"
|
||||
echo "select (tuple(1, 2, 3) as x).1;" | "$CLICKHOUSE_FORMAT"
|
Loading…
Reference in New Issue
Block a user