Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Major
    • Resolution: Duplicate
    • Affects Version/s: 10.4, 10.4.8
    • Fix Version/s: 10.4.9
    • Component/s: Parser
    • Labels:
      None
    • Environment:
      linux (ubuntu 18.04 64-bit, mariadb 10.4.8-MariaDB-1:10.4.8)

      Description

      Although issue is closed and marked as resolved for 10.4, I am experiencing a very similar bug using mariadb 10.4.8.

      Union with parentheses: https://jira.mariadb.org/browse/MDEV-11953

      MySQL bug, recently fixed for 8.0: https://bugs.mysql.com/bug.php?id=25734

      To replicate:

      create table `users` (`id` integer not null primary key auto_increment, `username` text not null);
      insert into `users` (`username`) values ('a'), ('b'), ('c');
       
      select * from `users` where (`id` IN (
          (select `id` from `users` where `username` = 'a') 
          UNION 
          (select `id` from `users` where `username` = 'c')));
      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 'UNION (select `id` from `users` where `username` = 'c')))' at line 1
      

      Removing the parentheses around the left-hand side of the compound query "fixes" it:

      select * from `users` where (`id` IN (
          select `id` from `users` where `username` = 'a' 
          UNION 
          (select `id` from `users` where `username` = 'c')));
       
      +----+----------+
      | id | username |
      +----+----------+
      |  1 | a        |
      |  3 | c        |
      +----+----------+
      

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                sanja Oleksandr Byelkin
                Reporter:
                coleifer Charles Leifer
              • Votes:
                1 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: