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

Cursor protocol returns empty string instead of NULL for super-aggregated column for SELECT WITH ROLLUP

    XMLWordPrintable

Details

    • Bug
    • Status: Open (View Workflow)
    • Major
    • Resolution: Unresolved
    • 10.4(EOL), 10.5, 10.6, 10.9(EOL), 10.10(EOL), 11.0(EOL), 11.1(EOL), 11.2(EOL)
    • 10.5, 10.6
    • None
    • None

    Description

      Testcase (run MTR test with --cursor-protocol):

      CREATE TABLE `example1463` (
        `Customer` varchar(255) NOT NULL,
        `DeliveryStatus` varchar(255) NOT NULL,
        `OrderSize` int(11) NOT NULL
      );
      INSERT INTO example1463 VALUES ('Charlie', 'Success', 100);
      INSERT INTO example1463 VALUES ('David', 'Success', 110);
      INSERT INTO example1463 VALUES ('Charlie', 'Failed', 200);
      INSERT INTO example1463 VALUES ('David', 'Success', 100);
      INSERT INTO example1463 VALUES ('David', 'Unknown', 100);
      INSERT INTO example1463 VALUES ('Edward', 'Success', 150);
      INSERT INTO example1463 VALUES ('Edward', 'Pending', 150);
       
      SELECT Customer, Success, SUM(OrderSize)
       FROM (SELECT Customer,
       CASE WHEN DeliveryStatus='Success' THEN 'Yes' ELSE 'No' END AS Success,
       OrderSize
       FROM example1463) as subQ
       GROUP BY Success, Customer
       WITH ROLLUP;
       
       DROP TABLE example1463;
      

      Expected result:

      Customer	Success	SUM(OrderSize)
      Charlie	No	200
      David	No	100
      Edward	No	150
      NULL	No	450
      Charlie	Yes	100
      David	Yes	210
      Edward	Yes	150
      NULL	Yes	460
      NULL	NULL	910
      

      Actual result:

      Customer	Success	SUM(OrderSize)
      Charlie	No	200
      David	No	100
      Edward	No	150
      	No	450
      Charlie	Yes	100
      David	Yes	210
      Edward	Yes	150
      	Yes	460
      		910
      

      Attachments

        Issue Links

          Activity

            People

              sanja Oleksandr Byelkin
              lstartseva Lena Startseva
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:

                Git Integration

                  Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.