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

Incorrect display of subquery cache in union.result

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 10.1
    • Fix Version/s: 10.1.2
    • Component/s: Optimizer
    • Labels:
      None

      Description

      Looking at union.result in 10.1 code, one can see:

      # 
      # Bug #49734: Crash on EXPLAIN EXTENDED UNION ... ORDER BY 
      #   <any non-const-function>
      # 
      CREATE TABLE t1 (a VARCHAR(10), FULLTEXT KEY a (a));
      INSERT INTO t1 VALUES (1),(2);
      CREATE TABLE t2 (b INT);
      INSERT INTO t2 VALUES (1),(2);

      ...

      EXPLAIN EXTENDED
      SELECT * FROM t1 UNION SELECT * FROM t1
      ORDER BY (SELECT a FROM t2 WHERE b = 12);
      id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
      1	PRIMARY	t1	ALL	NULL	NULL	NULL	NULL	2	100.00	
      2	UNION	t1	ALL	NULL	NULL	NULL	NULL	2	100.00	
      NULL	UNION RESULT	<union1,2>	ALL	NULL	NULL	NULL	NULL	NULL	NULL	Using filesort
      3	DEPENDENT SUBQUERY	t2	ALL	NULL	NULL	NULL	NULL	2	100.00	Using where
      Warnings:
      Note	1276	Field or reference 'a' of SELECT #3 was resolved in SELECT #-1
      Note	1003	select `test`.`t1`.`a` AS `a` from `test`.`t1` union select `test`.`t1`.`a` AS `a` from `test`.`t1` order by <expr_cache><>((select `a` from `test`.`t2` where (`test`.`t2`.`b` = 12)))

      Note this:

      <expr_cache><>((select `a` from `test`.`t2` where (`test`.`t2`.`b` = 12)))

      The subquery is actually dependent, and it is incorrect that we see "<expr_cache><>" and not "<expr_cache><a>".

        Attachments

          Activity

            People

            Assignee:
            psergey Sergei Petrunia
            Reporter:
            psergey Sergei Petrunia
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: