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

Impossible to execute prepared ANALYZE SELECT

Details

    • 10.2.5-1

    Description

      It's very easy to repeat the problem

      check_stmt_rc(mysql_stmt_prepare(stmt, "ANALYZE SELECT 1", -1), stmt);
      check_stmt_rc(mysql_stmt_execute(stmt), stmt);

      mysql_stmt_execute fails. The error is
      [HY000] The number of parameters in bound buffers differs from number of columns in resultset(2057)

      Server version I tested against is 10.2.3

      In CLI PREPARE+EXECUTE works fine
      MariaDB [test]> PREPARE analyze_select FROM "ANALYZE SELECT 1";
      Query OK, 0 rows affected (0.00 sec)
      Statement prepared

      MariaDB [test]> EXECUTE analyze_select;
      +------+-------------+-------+------+---------------+------+---------+------+------+--------+----------+------------+----------------+
      | id   | select_type | table | type | possible_keys | key  | key_len | ref  | rows | r_rows | filtered | r_filtered | Extra          |
      +------+-------------+-------+------+---------------+------+---------+------+------+--------+----------+------------+----------------+
      |    1 | SIMPLE      | NULL  | NULL | NULL          | NULL | NULL    | NULL | NULL |   NULL |     NULL |       NULL | No tables used |
      +------+-------------+-------+------+---------------+------+---------+------+------+--------+----------+------------+----------------+
      1 row in set (0.00 sec)
      

      The query can be any, in fact. Unless it has 13 columns, like ANALAYZE output, but then we probably have issue with wrong metadata Yes, it seems that returned metadata is for analyzed query, and not for ANALYZE result itself.

      I am not sure if that is not error in the server. In fact I'd imagine that is more probable

      Attachments

        Issue Links

          Activity

            georg Georg Richter added a comment - - edited

            After preparing the statement ANALYZE SELECT 1 the function mysql_stmt_field_count() returns 1 instead of 13.

            georg Georg Richter added a comment - - edited After preparing the statement ANALYZE SELECT 1 the function mysql_stmt_field_count() returns 1 instead of 13.
            sanja Oleksandr Byelkin added a comment - - edited

            It looks like EXPLAIN also return wrong number - 0.

            sanja Oleksandr Byelkin added a comment - - edited It looks like EXPLAIN also return wrong number - 0.

            there is processing of EXPLAIN In the set_sql_prepare() but nothing for ANALYSE. And both looks like returning wrong info (EXPLAIN do not report info).

            sanja Oleksandr Byelkin added a comment - there is processing of EXPLAIN In the set_sql_prepare() but nothing for ANALYSE. And both looks like returning wrong info (EXPLAIN do not report info).

            Looks like the fix works

            Lawrin Lawrin Novitsky added a comment - Looks like the fix works

            revision-id: 0f3c1f771011c432698f3e330b5aec522591be41 (mariadb-10.2.3-153-g0f3c1f77101)
            parent(s): 650ffcd3a081f0bf4e3b7de93fac72c1b67284e1
            committer: Oleksandr Byelkin
            timestamp: 2017-02-02 12:09:49 +0100
            message:

            MDEV-11966: Impossible to execute prepared ANALYZE SELECT

            Prepare os ANALYZE now respond as EXPLAIN.

            sanja Oleksandr Byelkin added a comment - revision-id: 0f3c1f771011c432698f3e330b5aec522591be41 (mariadb-10.2.3-153-g0f3c1f77101) parent(s): 650ffcd3a081f0bf4e3b7de93fac72c1b67284e1 committer: Oleksandr Byelkin timestamp: 2017-02-02 12:09:49 +0100 message: MDEV-11966 : Impossible to execute prepared ANALYZE SELECT Prepare os ANALYZE now respond as EXPLAIN. —

            revision-id: c544bba6d7c2c400a288a3d2f468d4f0e84d3908 (mariadb-10.2.4-28-gc544bba)
            parent(s): 0b1abc2f0f391d4e55029fa53f1e5da926f7be61
            committer: Oleksandr Byelkin
            timestamp: 2017-03-08 14:26:53 +0100
            message:

            MDEV-11966: Impossible to execute prepared ANALYZE SELECT

            Prepare os ANALYZE now respond as EXPLAIN.

            sanja Oleksandr Byelkin added a comment - revision-id: c544bba6d7c2c400a288a3d2f468d4f0e84d3908 (mariadb-10.2.4-28-gc544bba) parent(s): 0b1abc2f0f391d4e55029fa53f1e5da926f7be61 committer: Oleksandr Byelkin timestamp: 2017-03-08 14:26:53 +0100 message: MDEV-11966 : Impossible to execute prepared ANALYZE SELECT Prepare os ANALYZE now respond as EXPLAIN. —

            github branch bb-10.2-MDEV-11363

            sanja Oleksandr Byelkin added a comment - github branch bb-10.2- MDEV-11363

            Ok to push

            psergei Sergei Petrunia added a comment - Ok to push

            People

              sanja Oleksandr Byelkin
              Lawrin Lawrin Novitsky
              Votes:
              0 Vote for this issue
              Watchers:
              4 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.