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

Assertion `(thd->lex)->current_select' failed in MYSQLparse(), query with VALUES()

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 10.3, 10.4
    • Fix Version/s: 10.3.15
    • Component/s: Parser
    • Labels:
      None

      Description

      values (5), (7) limit 1;
      SELECT 2 UNION (values (5), (7) limit 1);
      

      10.3 95f3c142a4f2fdb088e534

      #6  0x00007f1f0fe95bd7 in __assert_fail_base (fmt=<optimized out>, assertion=assertion@entry=0x56362ad8944c "(thd->lex)->current_select", file=file@entry=0x56362ad13500 "/home/alice/git/10.3/sql/sql_yacc.yy", line=line@entry=12833, function=function@entry=0x56362ad8d3c0 <MYSQLparse(THD*)::__PRETTY_FUNCTION__> "int MYSQLparse(THD*)") at assert.c:92
      #7  0x00007f1f0fe95c82 in __GI___assert_fail (assertion=0x56362ad8944c "(thd->lex)->current_select", file=0x56362ad13500 "/home/alice/git/10.3/sql/sql_yacc.yy", line=12833, function=0x56362ad8d3c0 <MYSQLparse(THD*)::__PRETTY_FUNCTION__> "int MYSQLparse(THD*)") at assert.c:101
      #8  0x000056362a3739df in MYSQLparse (thd=0x7f1eb8000b00) at /home/alice/git/10.3/sql/sql_yacc.yy:12833
      #9  0x000056362a134302 in parse_sql (thd=0x7f1eb8000b00, parser_state=0x7f1f09492470, creation_ctx=0x0, do_pfs_digest=true) at /home/alice/git/10.3/sql/sql_parse.cc:10102
      #10 0x000056362a12f45b in mysql_parse (thd=0x7f1eb8000b00, rawbuf=0x7f1eb8014cd8 "values (5), (7) limit 1", length=23, parser_state=0x7f1f09492470, is_com_multi=false, is_next_command=false) at /home/alice/git/10.3/sql/sql_parse.cc:8044
      #11 0x000056362a11c49f in dispatch_command (command=COM_QUERY, thd=0x7f1eb8000b00, packet=0x7f1eb8161121 "values (5), (7) limit 1", packet_length=23, is_com_multi=false, is_next_command=false) at /home/alice/git/10.3/sql/sql_parse.cc:1850
      #12 0x000056362a11aebc in do_command (thd=0x7f1eb8000b00) at /home/alice/git/10.3/sql/sql_parse.cc:1395
      #13 0x000056362a2827b4 in do_handle_one_connection (connect=0x56362c76ebc0) at /home/alice/git/10.3/sql/sql_connect.cc:1402
      #14 0x000056362a282505 in handle_one_connection (arg=0x56362c76ebc0) at /home/alice/git/10.3/sql/sql_connect.cc:1308
      #15 0x000056362ab5d63c in pfs_spawn_thread (arg=0x56362c777160) at /home/alice/git/10.3/storage/perfschema/pfs.cc:1862
      #16 0x00007f1f10ada6ba in start_thread (arg=0x7f1f09493700) at pthread_create.c:333
      #17 0x00007f1f0ff6f41d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:109
      

      on 10.4 LIMIT is ignored:

      MariaDB [test]> values (5), (7) limit 1;
      +---+
      | 5 |
      +---+
      | 5 |
      +---+
      1 row in set (0.001 sec)
       
      MariaDB [test]> SELECT 2 UNION (values (5), (7) limit 1);
      +---+
      | 2 |
      +---+
      | 2 |
      | 5 |
      | 7 |
      +---+
      3 rows in set (0.003 sec)
      

      At the same time KB says "The VALUES() function is meaningful only in INSERT ... ON DUPLICATE KEY UPDATE statements and returns NULL otherwise."

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                igor Igor Babaev
                Reporter:
                alice Alice Sherepa
              • Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: