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

LP:992405 - Wrong result when using SQL_BUFFER_RESULT if min/max loose scan is chosen

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: None
    • Labels:

      Description

      The following sequence of commands brings us to a wrong result in MariaDB 5.2 :

      CREATE TABLE t1 (a int, b varchar(1), KEY (b,a) );
      INSERT INTO t1 VALUES (1,NULL),(0,'a');
      SINSERT INTO t1 VALUES (2,'x'),(0,'y');
      SELECT SQL_BUFFER_RESULT MIN(a), b FROM t1 WHERE t1.b = 'a' GROUP BY b;

      MariaDB [test]> SELECT SQL_BUFFER_RESULT MIN(a), b FROM t1 WHERE t1.b = 'a' GROUP BY b;
      ------------+

      MIN(a) b

      ------------+

      NULL NULL

      ------------+

      The result is correct without the modifier SQL_BUFFER_RESULT:

      MariaDB [test]> SELECT MIN(a), b FROM t1 WHERE t1.b = 'a' GROUP BY b;
      ------------+

      MIN(a) b

      ------------+

      0 a

      ------------+

      (See also bug #12640437 for mysql-5.6)

        Gliffy Diagrams

          Attachments

            Activity

            Hide
            ratzpo Rasmus Johansson added a comment -

            Launchpad bug id: 992405

            Show
            ratzpo Rasmus Johansson added a comment - Launchpad bug id: 992405

              People

              • Assignee:
                timour Timour Katchaounov
                Reporter:
                igor Igor Babaev
              • Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: