add bug: second parenthesis ) not hilited in CREATE TABLE name AS (SELECT *) COMMENT 'hello'

This commit is contained in:
natasha 2023-03-28 12:58:23 +01:00
parent 5681f2c130
commit f36ad31751
2 changed files with 12 additions and 1 deletions

View File

@ -443,7 +443,7 @@ void ASTCreateQuery::formatQueryImpl(const FormatSettings & settings, FormatStat
<< (comment ? "(" : "")
<< settings.nl_or_ws << (settings.hilite ? hilite_none : "");
select->formatImpl(settings, state, frame);
settings.ostr << (comment ? ")" : "");
settings.ostr << (settings.hilite ? hilite_keyword : "") << (comment ? ")" : "") << (settings.hilite ? hilite_none : "");
}
if (comment)

View File

@ -300,3 +300,14 @@ TEST(FormatHiliting, ASTKillQueryQuery)
compare(query, expected);
}
TEST(FormatHiliting, ASTCreateQuery)
{
// The misplaced space around ( is on purpose, as this bug will fixed in a separate PR.
String query = "CREATE TABLE name AS( SELECT *) COMMENT 'hello'";
String expected = keyword("CREATE TABLE ") + identifier("name ") + keyword("AS( SELECT ") + "*" + keyword(")")
+ keyword("COMMENT") + "'hello'";
compare(query, expected);
}