SQL with escape character for LIKE clause can fail with syntax error
ericsun2 opened this issue · 1 comments
ericsun2 commented
As long as escape '!'
or escape '\\'
is following LIKE clause in ODBC mode, PyTd fails into the following error:
SELECT DatabaseName, PermSpace, DBKind
FROM DBC.DatabasesV WHERE DatabaseName LIKE 'DW!_%' escape '!'
ErrorCode = 3706
ErrorMessage = [42000] [Teradata][ODBC Teradata Driver][Teradata Database](-3706)Syntax error: expected something between the word 'TODO' and ':'.
It looks like a parsing error inside PyTd or ODBC code.
Simply remove the escape '!'
part, the query will run (of course with 0 rows returned).
The following alternative works too, but LIKE '%!_test!_' escape '!'
should be supported.
SELECT DatabaseName, PermSpace, DBKind
FROM DBC.DatabasesV WHERE substr(DatabaseName, 1, 3) = 'DW_'