Skip to content

SQL with escape character for LIKE clause can fail with syntax error #103

Open

Description

@ericsun2

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_' 

Activity

  1. padhia commented on Jun 13, 2018

    @padhia
    Contributor

    What version of ODBC driver are you using? I had encountered a similar error #90 when using the new Simba drivers which since has been fixed in the later updates.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions