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

SUM(distinct) gives wrong result when reducing max_heap_table_size

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Major
    • Resolution: Fixed
    • 5.5.28a, 5.3.11, 5.2.13, 5.1.67
    • 5.5.29
    • None

    Description

      CREATE TABLE t1 (id INTEGER);
      CREATE TABLE t2 (id INTEGER);
      INSERT INTO t1 VALUES (1), (1), (1),(1);
      INSERT INTO t1 SELECT id FROM t1;
      INSERT INTO t1 SELECT id FROM t1;
      INSERT INTO t1 SELECT id FROM t1;
      INSERT INTO t1 SELECT id FROM t1;
      INSERT INTO t1 SELECT id FROM t1;
      INSERT INTO t1 SELECT id+1 FROM t1;
      INSERT INTO t1 SELECT id+2 FROM t1;
      INSERT INTO t1 SELECT id+4 FROM t1;
      INSERT INTO t1 SELECT id+8 FROM t1;
      INSERT INTO t1 SELECT id+16 FROM t1;
      INSERT INTO t1 SELECT id+32 FROM t1;
      INSERT INTO t1 SELECT id+64 FROM t1;
      INSERT INTO t1 SELECT id+128 FROM t1;
      INSERT INTO t1 SELECT id+256 FROM t1;
      INSERT INTO t1 SELECT id+512 FROM t1;
      INSERT INTO t1 SELECT id+1024 FROM t1;
      INSERT INTO t1 SELECT id+2048 FROM t1;
      INSERT INTO t1 SELECT id+4096 FROM t1;
      INSERT INTO t1 SELECT id+8192 FROM t1;
      INSERT INTO t2 SELECT id FROM t1 ORDER BY id*rand();
      SELECT SUM(DISTINCT id) sm FROM t2;
      SET max_heap_table_size=16384;
      SHOW variables LIKE 'max_heap_table_size';
      SELECT SUM(DISTINCT id) sm FROM t2;
      DROP TABLE t1;
      DROP TABLE t2;

      second SUM(DISTINCT) returns NULL

      Attachments

        Issue Links

          Activity

            People

              igor Igor Babaev
              igor Igor Babaev
              Votes:
              0 Vote for this issue
              Watchers:
              3 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.