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

LP:1004615 - Unexpected warnings "Encountered illegal value '' when converting to DECIMAL" on a query with aggregate functions and GROUP BY

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 5.3.9
    • Fix Version/s: 5.5.28a, 5.3.10
    • Component/s: None
    • Labels:

      Description

      Initially reported as a LP question: https://answers.launchpad.net/maria/+question/198446

      SELECT f1, MIN(f2), AVG(f2), SUM(f2) FROM t1 
      GROUP BY f1 LIMIT 1;
      f1	MIN(f2)	AVG(f2)	SUM(f2)
      1	1.0	1.00000	1.0
      Warnings:
      Error	1918	Encountered illegal value '' when converting to DECIMAL
      

      LIMIT is not important here, it just reduces the amount of output.
      The warning only appears with certain number of rows in the table (over 11,000 in the provided test case).
      Reproducible on maria-5.3 revno 3526, maria-5.5 revno 3418.
      Not reproducible on maria-5.2, mysql-5.1, mysql-5.5, mysql-trunk.
      Reproducible with default optimizer switch as well as all OFF values.

      # Test case:
      
      --disable_warnings
      DROP TABLE IF EXISTS t1;
      --enable_warnings
      CREATE TABLE t1 ( f1 INT, f2 decimal(20,1) ) ENGINE=MyISAM;
      
      --disable_query_log
      let $i= 11000;
      --echo # <Insert $i rows into the table>
      while ($i)
      {
        eval INSERT INTO t1 values($i,$i);
        dec $i;
      }
      --enable_query_log
      
      INSERT INTO t1 values(11001,NULL),(11001,NULL);
      
      SELECT f1, MIN(f2), AVG(f2), SUM(f2) FROM t1 
        GROUP BY f1 LIMIT 1;
      
      DROP TABLE IF EXISTS t1;
      
      # End of test case
      

        Gliffy Diagrams

          Attachments

            Activity

            Hide
            ratzpo Rasmus Johansson added a comment -

            Launchpad bug id: 1004615

            Show
            ratzpo Rasmus Johansson added a comment - Launchpad bug id: 1004615
            Hide
            thatsafunnyname Peter (Stig) Edwards added a comment -

            Not reproducible on maria-5.3.8.

            Show
            thatsafunnyname Peter (Stig) Edwards added a comment - Not reproducible on maria-5.3.8.
            Hide
            serg Sergei Golubchik added a comment -

            pushed in 5.3-serg

            Show
            serg Sergei Golubchik added a comment - pushed in 5.3-serg

              People

              • Assignee:
                serg Sergei Golubchik
                Reporter:
                elenst Elena Stepanova
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0 minutes
                  0m
                  Logged:
                  Time Spent - 4 hours
                  4h