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

Failing assertion lex->proc_list.elements == 0 or syntax error on PROCEDURE ANALYSE in UNION

Details

    Description

      PROCEDURE clause is not allowed in UNION. Previously, an attempt to use it caused a decent error ER_WRONG_USAGE. But now it causes either a syntax error on a release build, or an assertion failure on a debug build:

      Stack trace from 10.2 025c4ec191e46719d3c51af6ee7a0ecc7a7dd335

      mysqld: /data/src/10.2/sql/sql_parse.cc:7489: bool mysql_new_select(LEX*, bool): Assertion `lex->proc_list.elements == 0' failed.
      160912 15:05:21 [ERROR] mysqld got signal 6 ;
      ...
      #6  0x00007fb45cd4c266 in __assert_fail_base (fmt=0x7fb45ce85238 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=assertion@entry=0x7fb45ff1eadd "lex->proc_list.elements == 0", file=file@entry=0x7fb45ff1d658 "/data/src/10.2/sql/sql_parse.cc", line=line@entry=7489, function=function@entry=0x7fb45ff1fd00 <mysql_new_select(LEX*, bool)::__PRETTY_FUNCTION__> "bool mysql_new_select(LEX*, bool)") at assert.c:92
      #7  0x00007fb45cd4c312 in __GI___assert_fail (assertion=0x7fb45ff1eadd "lex->proc_list.elements == 0", file=0x7fb45ff1d658 "/data/src/10.2/sql/sql_parse.cc", line=7489, function=0x7fb45ff1fd00 <mysql_new_select(LEX*, bool)::__PRETTY_FUNCTION__> "bool mysql_new_select(LEX*, bool)") at assert.c:101
      #8  0x00007fb45f5dc347 in mysql_new_select (lex=0x7fb454019a50, move_down=false) at /data/src/10.2/sql/sql_parse.cc:7489
      #9  0x00007fb45f7a7bed in add_select_to_union_list (lex=0x7fb454019a50, is_union_distinct=true, is_top_level=true) at /data/src/10.2/sql/sql_yacc.yy:707
      #10 0x00007fb45f7d176b in MYSQLparse (thd=0x7fb454016070) at /data/src/10.2/sql/sql_yacc.yy:16092
      #11 0x00007fb45f5e15f3 in parse_sql (thd=0x7fb454016070, parser_state=0x7fb46052cdd0, creation_ctx=0x0, do_pfs_digest=true) at /data/src/10.2/sql/sql_parse.cc:9793
      #12 0x00007fb45f5dcfd7 in mysql_parse (thd=0x7fb454016070, rawbuf=0x7fb454064088 "( SELECT * FROM t1 PROCEDURE ANALYSE( 10, 10 ) ) \nUNION\n( SELECT * FROM t1 PROCEDURE ANALYSE( 10, 10 ) )", length=104, parser_state=0x7fb46052cdd0, is_com_multi=false, is_next_command=false) at /data/src/10.2/sql/sql_parse.cc:7727
      #13 0x00007fb45f5cb555 in dispatch_command (command=COM_QUERY, thd=0x7fb454016070, packet=0x7fb454058071 "( SELECT * FROM t1 PROCEDURE ANALYSE( 10, 10 ) ) \nUNION\n( SELECT * FROM t1 PROCEDURE ANALYSE( 10, 10 ) )", packet_length=104, is_com_multi=false, is_next_command=false) at /data/src/10.2/sql/sql_parse.cc:1805
      #14 0x00007fb45f5c9f86 in do_command (thd=0x7fb454016070) at /data/src/10.2/sql/sql_parse.cc:1365
      #15 0x00007fb45f705912 in do_handle_one_connection (connect=0x7fb45c46d410) at /data/src/10.2/sql/sql_connect.cc:1354
      #16 0x00007fb45f70569f in handle_one_connection (arg=0x7fb45c46d410) at /data/src/10.2/sql/sql_connect.cc:1260
      #17 0x00007fb45fa13ea4 in pfs_spawn_thread (arg=0x7fb45c4519f0) at /data/src/10.2/storage/perfschema/pfs.cc:1862
      #18 0x00007fb45ec4e0a4 in start_thread (arg=0x7fb46052e300) at pthread_create.c:309
      #19 0x00007fb45ce0687d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:111
      

      Test case

      CREATE TABLE t1 (i INT);
       
      --error ER_WRONG_USAGE
      ( SELECT * FROM t1 PROCEDURE ANALYSE( 10, 10 ) ) 
      UNION
      ( SELECT * FROM t1 PROCEDURE ANALYSE( 10, 10 ) );
      

      It started happening after recent merges.

      Attachments

        Activity

          perl ./runall-new.pl --no-mask --seed=1473250770 --threads=2 --duration=900 --queries=100M --reporters=QueryTimeout,Backtrace,ErrorLog,Deadlock,Shutdown --redefine=conf/mariadb/redefine_random_keys.yy  --validators=TransformerNoComparator --transformers=ExecuteAsUnion --grammar=mdev10779-2.yy --gendata=conf/runtime/concurrency_1.zz --mtr-build-thread=300 --basedir1=/data/bld/10.2 --vardir1=/data/logs/analyze5b
          

          mdev10779-2.yy

          RQG 22d8d863bab (experimental branch)

          elenst Elena Stepanova added a comment - perl ./runall-new.pl --no-mask --seed=1473250770 --threads=2 --duration=900 --queries=100M --reporters=QueryTimeout,Backtrace,ErrorLog,Deadlock,Shutdown --redefine=conf/mariadb/redefine_random_keys.yy --validators=TransformerNoComparator --transformers=ExecuteAsUnion --grammar=mdev10779-2.yy --gendata=conf/runtime/concurrency_1.zz --mtr-build-thread=300 --basedir1=/data/bld/10.2 --vardir1=/data/logs/analyze5b mdev10779-2.yy RQG 22d8d863bab (experimental branch)

          The problem is that before mysql_new_select() reported this error.
          Now it replaced with DBUG_ASSERT by this patch:
          commit dd283db6bc4ecbb18127a8b10d49073047ea990b
          Author: Alexander Barkov <bar@mariadb.org> Wed Sep 7 09:36:22 2016
          Committer: Alexander Barkov <bar@mariadb.org> Wed Sep 7 09:36:22 2016

          MDEV-8909 union parser cleanup

          This is the final patch removing some old remainders that are
          not needed anymore.

          So probably author of the patch knowing more how to fix.

          sanja Oleksandr Byelkin added a comment - The problem is that before mysql_new_select() reported this error. Now it replaced with DBUG_ASSERT by this patch: commit dd283db6bc4ecbb18127a8b10d49073047ea990b Author: Alexander Barkov <bar@mariadb.org> Wed Sep 7 09:36:22 2016 Committer: Alexander Barkov <bar@mariadb.org> Wed Sep 7 09:36:22 2016 MDEV-8909 union parser cleanup This is the final patch removing some old remainders that are not needed anymore. So probably author of the patch knowing more how to fix.

          People

            bar Alexander Barkov
            elenst Elena Stepanova
            Votes:
            0 Vote for this issue
            Watchers:
            2 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.