mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-21 15:12:02 +00:00
Better formatting of CREATE queries
This commit is contained in:
parent
1c5c2f8c69
commit
e9eb722d4a
@ -197,6 +197,7 @@ ASTPtr ASTCreateQuery::clone() const
|
||||
void ASTCreateQuery::formatQueryImpl(const FormatSettings & settings, FormatState & state, FormatStateStacked frame) const
|
||||
{
|
||||
frame.need_parens = false;
|
||||
frame.expression_list_always_start_on_new_line = true;
|
||||
|
||||
if (!database.empty() && table.empty())
|
||||
{
|
||||
|
@ -39,10 +39,12 @@ void ASTExpressionList::formatImplMultiline(const FormatSettings & settings, For
|
||||
settings.ostr << separator;
|
||||
}
|
||||
|
||||
if (children.size() > 1)
|
||||
if (children.size() > 1 || frame.expression_list_always_start_on_new_line)
|
||||
settings.ostr << indent_str;
|
||||
|
||||
(*it)->formatImpl(settings, state, frame);
|
||||
FormatStateStacked frame_nested = frame;
|
||||
frame_nested.expression_list_always_start_on_new_line = false;
|
||||
(*it)->formatImpl(settings, state, frame_nested);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -202,6 +202,7 @@ public:
|
||||
{
|
||||
UInt8 indent = 0;
|
||||
bool need_parens = false;
|
||||
bool expression_list_always_start_on_new_line = false; /// Line feed and indent before expression list even if it's of single element.
|
||||
const IAST * current_select = nullptr;
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user