Uploaded image for project: 'MariaDB MaxScale'
  1. MariaDB MaxScale
  2. MXS-1688

Some date functions are not parsed properly with schemarouter

    XMLWordPrintable

Details

    Description

      When non-default database is referred in statements using the following datetime-related functions with INTERVAL clauses:

      DATE_SUB(('date1',INTERVAL x DAY)
      SUBDATE('date1',INTERVAL x DAY)
      DATE_ADD('date1',INTERVAL x DAY)
      ADDDATE('date1',INTERVAL x DAY)
      

      for example:

      select id from db2.t1 where DATE_ADD("2017-06-15", INTERVAL 10 DAY) < "2017-06-15";
      

      schemarouter can not parse them properly and produces table dioesn't exist error (even if the table exists only in the referred database db2.

      In the log we see:

      2018-02-26 23:34:10   warning: (7) [qc_sqlite] Statement was classified only based on keywords (Sqlite3 error: SQL logic error or missing database, near "INTERVAL": syntax error): "select id from db2.t1 where DATE_ADD("2017-06-15", INTERVAL 10 DAY) < "2017-06-15""
      

      So, it's a parser error.

      Attachments

        Activity

          People

            johan.wikman Johan Wikman
            valerii Valerii Kravchuk
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Git Integration

                Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.