Fix inconsistent formatting of INSERT queries

This commit is contained in:
Alexey Milovidov 2024-02-17 10:11:59 +01:00
parent 6b32622c7d
commit 69dfd721ce
3 changed files with 14 additions and 1 deletions

View File

@ -91,7 +91,8 @@ static inline void writeProbablyQuotedStringImpl(StringRef s, WriteBuffer & buf,
if (isValidIdentifier(s.toView()) if (isValidIdentifier(s.toView())
/// This are valid identifiers but are problematic if present unquoted in SQL query. /// This are valid identifiers but are problematic if present unquoted in SQL query.
&& !(s.size == strlen("distinct") && 0 == strncasecmp(s.data, "distinct", strlen("distinct"))) && !(s.size == strlen("distinct") && 0 == strncasecmp(s.data, "distinct", strlen("distinct")))
&& !(s.size == strlen("all") && 0 == strncasecmp(s.data, "all", strlen("all")))) && !(s.size == strlen("all") && 0 == strncasecmp(s.data, "all", strlen("all")))
&& !(s.size == strlen("table") && 0 == strncasecmp(s.data, "table", strlen("table"))))
{ {
writeString(s, buf); writeString(s, buf);
} }

View File

@ -0,0 +1,3 @@
1
2
(1)

View File

@ -0,0 +1,9 @@
CREATE TEMPORARY TABLE table (x UInt8);
INSERT INTO `table` FORMAT Values (1);
INSERT INTO TABLE `table` FORMAT Values (2);
SELECT * FROM table ORDER BY x;
DROP TABLE table;
CREATE TEMPORARY TABLE FORMAT (x UInt8);
INSERT INTO table FORMAT Values (1);
SELECT * FROM FORMAT FORMAT Values;