Files
email-tracker/external/duckdb/test/sql/parser/invisible_spaces.test
2025-10-24 19:21:19 -05:00

69 lines
1.2 KiB
SQL
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# 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.*