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

IN AND misplaced parenthesis bug

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Minor
    • Resolution: Not a Bug
    • None
    • N/A
    • Parser
    • None
    • Not for Release Notes

    Description

      I was working to construct an SQL query to prevent draft messages from being moved to different folders. After adding the 'Drafts' folder exception I forgot to move the parenthesis. Here is the malformed SQL query that failed to trigger a syntax error:

      SELECT me.id, fo.folder FROM messages AS me INNER JOIN folders AS fo ON (fo.id = me.id_folders) WHERE me.id IN('13515','13514','13512','13511','13510','13509','13507','13506','13505','13504','13502' AND folder!='Drafts');

      This returned the messages in the 'Drafts' folder and I did not receive a syntax error. That being said, I don't want to rain on anyone else's parade if they have a legitimate use for the same general syntax structure. I figured, if there is no viable use-case then someone else might have this problem and could have been spared having their time wasted if they had received a syntax error.

      For contrast, here is the corrected SQL query:

      SELECT me.id, fo.folder FROM messages AS me INNER JOIN folders AS fo ON (fo.id = me.id_folders) WHERE me.id IN('13515','13514','13512','13511','13510','13509','13507','13506','13505','13504','13502') AND folder!='Drafts';

      Attachments

        Activity

          People

            Unassigned Unassigned
            JAB Creations John Bilicki
            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.