Add support for queries with null quoted identifier and ON CLUSTER

This commit is contained in:
Alexey Milovidov 2021-07-02 02:01:13 +03:00
parent 919cc10a3c
commit 2866d45681
3 changed files with 11 additions and 1 deletions

View File

@ -149,7 +149,11 @@ inline bool isPunctuationASCII(char c)
inline bool isValidIdentifier(const std::string_view & str)
{
return !str.empty() && isValidIdentifierBegin(str[0]) && std::all_of(str.begin() + 1, str.end(), isWordCharASCII);
return !str.empty()
&& isValidIdentifierBegin(str[0])
&& std::all_of(str.begin() + 1, str.end(), isWordCharASCII)
/// NULL is not a valid identifier in SQL, any case.
&& !(str.size() == strlen("null") && 0 == strncasecmp(str.data(), "null", strlen("null")));
}
/// Works assuming isAlphaASCII.

View File

@ -0,0 +1,3 @@
1
1
1 \N

View File

@ -0,0 +1,3 @@
SELECT `null` FROM remote('127.0.0.2', view(SELECT 1 AS `null`));
SELECT `NULL` FROM remote('127.0.0.2', view(SELECT 1 AS `NULL`));
SELECT `nULl`, null FROM remote('127.0.0.2', view(SELECT 1 AS `nULl`));