mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-15 12:14:18 +00:00
366f368d06
Trailing escape ('ab\') is disallowed in SQL, in standardese: "If an escape character is specified, then [...] If there is not a partitioning of the string PVC into substrings such that each substring has length 1 (one) or 2, no substring of length 1 (one) is the escape character ECV, and each substring of length 2 is the escape character ECV followed by either the escape character ECV, an <underscore> character, or the <percent> character, then an exception condition is raised: data exception - invalid escape sequence." I first thought this is checked already higher up in the stack, at least for const needles, as single trailing backslashes ('ab\') are rejected, but then I realized that ClickHouse quotes by default. I.e., double trailing backslashes ('ab\\') are not rejected but when interpreted as LIKE needle ('ab\') they should.
31 lines
700 B
SQL
31 lines
700 B
SQL
SELECT '\w' LIKE '%\w%';
|
|
SELECT '\w' LIKE '\w%';
|
|
SELECT '\w' LIKE '%\w';
|
|
SELECT '\w' LIKE '\w';
|
|
|
|
SELECT '\\w' LIKE '%\\w%';
|
|
SELECT '\\w' LIKE '\\w%';
|
|
SELECT '\\w' LIKE '%\\w';
|
|
SELECT '\\w' LIKE '\\w';
|
|
|
|
SELECT '\i' LIKE '%\i%';
|
|
SELECT '\i' LIKE '\i%';
|
|
SELECT '\i' LIKE '%\i';
|
|
SELECT '\i' LIKE '\i';
|
|
|
|
SELECT '\\i' LIKE '%\\i%';
|
|
SELECT '\\i' LIKE '\\i%';
|
|
SELECT '\\i' LIKE '%\\i';
|
|
SELECT '\\i' LIKE '\\i';
|
|
|
|
SELECT '\\' LIKE '%\\\\%';
|
|
SELECT '\\' LIKE '\\\\%';
|
|
SELECT '\\' LIKE '%\\\\';
|
|
SELECT '\\' LIKE '\\\\';
|
|
SELECT '\\' LIKE '\\'; -- { serverError 25 }
|
|
|
|
SELECT '\\xyz\\' LIKE '\\\\%\\\\';
|
|
SELECT '\\xyz\\' LIKE '\\\\___\\\\';
|
|
SELECT '\\xyz\\' LIKE '\\\\_%_\\\\';
|
|
SELECT '\\xyz\\' LIKE '\\\\%_%\\\\';
|