Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-31424

White space in a query seems to affect parsing

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Major
    • Resolution: Not a Bug
    • 10.5.19
    • N/A
    • None
    • mariadb Ver 15.1 Distrib 10.5.19-MariaDB, for debian-linux-gnu (x86_64) using EditLine wrapper

    Description

      It is not "subquery", just "query".

      Unbelievably, I was entering a query that someone sent me by email. It was split in several lines, which I copied and pasted in a client terminal. It replied with an error. I could spot no errors, and the query was very similar to a previous one which only had a single find_in_set condition. So I started recalling the query by ↑(up arrow) and removing a space. The last attempt succeeded. Here's the last but one and the last:

      MariaDB [mail]>  Select m.id as messageid, d.domain as SpfDomain     from message_in as m, domain as d, msg_ref as r     where     r.domain = d.id and r.message_in = m.id and find_in_set('spf', r.auth)>0    and find_in_set('aligned', r.auth)>0 limit 2;
      ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ' and find_in_set('aligned', r.auth)>0 limit 2' at line 1
      MariaDB [mail]> 
      MariaDB [mail]>  Select m.id as messageid, d.domain as SpfDomain     from message_in as m, domain as d, msg_ref as r     where     r.domain = d.id and r.message_in = m.id and find_in_set('spf', r.auth)>0   and find_in_set('aligned', r.auth)>0 limit 2;
      +-----------+------------------------+
      | messageid | SpfDomain              |
      +-----------+------------------------+
      |   1229557 | mailop.org             |
      |   1229558 | studiolegalemantini.it |
      +-----------+------------------------+
      2 rows in set (0.001 sec)
      

      The difference is a single space before the last `and`.

      The database is depicted here

      Attachments

        Activity

          People

            Unassigned Unassigned
            Ale2019 Alessandro Vesely
            Votes:
            0 Vote for this issue
            Watchers:
            3 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.