Closed
Description
In standard SQL, the \
character has no special meaning in '...'
varchar literals.
In PostgreSQL
postgres=# SELECT '\', '\\'
postgres-# ;
?column? | ?column?
----------+----------
\ | \\
(1 row)
in DataFusion sqllogictest the behavior is the same:
query T
SELECT '\'
----
\
query T
SELECT '\\'
----
\\
query T
SELECT '\\\'
----
\\\
query T
SELECT '\\\\'
----
\\\\
However, DataFusion CLI behaves differently
$ cargo run
Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.15s
Running `target/debug/datafusion-cli`
DataFusion CLI v43.0.0
> SELECT '\\';
+-----------+
| Utf8("\") |
+-----------+
| \ |
+-----------+
1 row(s) fetched.
Elapsed 0.049 seconds.
> SELECT '\'; 🤔 Invalid statement: SQL error: TokenizerError("unsupported escape char: '\\''")
Given that DataFusion CLI is used a lot to test and verify DataFusion's behavior, it's super important for the CLI to behave correctly with respect to its input.