1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69
|
# name: test/sql/parser/invisible_spaces.test
# description: Test invisible spaces
# group: [parser]
statement ok
PRAGMA enable_verification
# non-breaking space
query I
SELECT 42;
----
42
# test all special unicode spaces
# see https://jkorpela.fi/chars/spaces.html for a list
foreach unicode_space
query I
SELECT${unicode_space}42;
----
42
# unicode space in strings are not modified
query I
SELECT${unicode_space}strlen('${unicode_space}')>=2;
----
true
# unicode spaces in strings with escaped quotes
query I
SELECT${unicode_space}strlen(' ''${unicode_space}')>=4;
----
true
# unicode space in comment
query I
SELECT${unicode_space} -- ${unicode_space};
42
----
42
# multiple unicode spaces
query I
SELECT${unicode_space}42${unicode_space}${unicode_space}${unicode_space}${unicode_space}${unicode_space}
----
42
# invisible space in identifiers
query I
SELECT a${unicode_space} FROM (SELECT 42) t(a);
----
42
endloop
# the query can still fail even after replacing unicode spaces
statement error
SELEC
----
<REGEX>:.*Parser Error.*syntax error.*
# only a unicode space
statement ok
statement error
S
----
<REGEX>:.*Parser Error.*syntax error.*
|