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

Warnings for EDOM vs truncation in val_int, val_real, val_decimal

    XMLWordPrintable

Details

    • Bug
    • Status: Open (View Workflow)
    • Minor
    • Resolution: Unresolved
    • 5.1.67, 5.2.14, 5.3.12, 10.3.4, 5.5(EOL), 10.0(EOL), 10.1(EOL), 10.4(EOL), 10.5(EOL)
    • 10.6
    • OTHER

    Description

      When a string value is insterted into an INT, DOUBLE or DECIMAL column, it send different warnings in case of EDOM errors (when they could not find any digits) and truncation errors:

      DROP TABLE IF EXISTS t1;
      CREATE TABLE t1 (a INT);
      INSERT INTO t1 VALUES (''),('123x');
      SHOW WARNINGS;

      +---------+------+-----------------------------------------------------+
      | Level   | Code | Message                                             |
      +---------+------+-----------------------------------------------------+
      | Warning | 1366 | Incorrect integer value: '' for column 'a' at row 1 |
      | Warning | 1265 | Data truncated for column 'a' at row 2              |
      +---------+------+-----------------------------------------------------+

      If I force implicit string-to-number conversion the other way around:

      DROP TABLE IF EXISTS t1;
      CREATE TABLE t1 (a VARCHAR(10));
      INSERT INTO t1 VALUES (''),('123x');
      SELECT a+1 FROM t1;
      SHOW WARNINGS;

      it does not distinguish between EDOM and truncation:

      +---------+------+------------------------------------------+
      | Level   | Code | Message                                  |
      +---------+------+------------------------------------------+
      | Warning | 1292 | Truncated incorrect DOUBLE value: ''     |
      | Warning | 1292 | Truncated incorrect DOUBLE value: '123x' |
      +---------+------+------------------------------------------+

      Functions and literals also do not distinguish between EDOM and truncation:

      SELECT ''+1,'123x'+1;
      SHOW WARNINGS;

      +---------+------+------------------------------------------+
      | Level   | Code | Message                                  |
      +---------+------+------------------------------------------+
      | Warning | 1292 | Truncated incorrect DOUBLE value: ''     |
      | Warning | 1292 | Truncated incorrect DOUBLE value: '123x' |
      +---------+------+------------------------------------------+

      In case of EDOM the warning tells about truncation, which is not true.

      Attachments

        Activity

          People

            bar Alexander Barkov
            bar Alexander Barkov
            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.