Open findepi opened 2 weeks ago
Is there any reason to not follow Postgres?
PostgreSQL chose to depart from SQL spec here, where most other systems did not. But yes, we can stick to PostgreSQL from DataFusion SQL dialect perspective. It would still be valuable to support escape-less LIKE expressions in the DF LP.
Is your feature request related to a problem or challenge?
in standard SQL, as well as in a few systems LIKE pattern without explicit ESCAPE has no implicit ESCAPE character. Or at (least it's not a backslash)
Some systems WITHOUT implicit
\
escape in LIKE patternsOracle 23c
https://docs.oracle.com/en/database/oracle/oracle-database/23/sqlrf/Pattern-matching-Conditions.html#GUID-3FA7F5AB-AC64-4200-8F90-294101428C26
I couldn't confirm this with db-fiddle. I think it's processing
\%
incorrectly on query input or outputTrino 461
SQL Server
Snowflake
(note: not using GitHub markdown table rendering, as it renders
\%
in cells as%
)Some systems WITH implicit
\
escape in LIKE patternsPostgreSQL 17
DataFusion
not showing CLI output due to https://github.com/apache/datafusion/issues/13286
SLT test is like this (copied from https://github.com/apache/datafusion/pull/13288)
Describe the solution you'd like
I'd like DataFusion to follow SQL standard. LIKE without an ESCAPE should behave as not having an escape character. LIKE with
ESCAPE '\'
should behave as having\
escape character.Describe alternatives you've considered
Picking arbitrary escape character to represent LIKE without an ESCAPE. This works for static patterns, as the pattern can be verified not to contain the escape character chosen. This does not work however for patterns being dynamic.
Additional context