Fix inconsistent formatting for GRANT CURRENT GRANTS

This commit is contained in:
pufit 2024-08-02 00:01:41 -04:00
parent 183a3521de
commit c50ef37a03

View File

@ -97,24 +97,9 @@ namespace
void formatCurrentGrantsElements(const AccessRightsElements & elements, const IAST::FormatSettings & settings) void formatCurrentGrantsElements(const AccessRightsElements & elements, const IAST::FormatSettings & settings)
{ {
for (size_t i = 0; i != elements.size(); ++i) settings.ostr << "(";
{ formatElementsWithoutOptions(elements, settings);
const auto & element = elements[i]; settings.ostr << ")";
bool next_element_on_same_db_and_table = false;
if (i != elements.size() - 1)
{
const auto & next_element = elements[i + 1];
if (element.sameDatabaseAndTableAndParameter(next_element))
next_element_on_same_db_and_table = true;
}
if (!next_element_on_same_db_and_table)
{
settings.ostr << " ";
formatONClause(element, settings);
}
}
} }
} }