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

CAST('' AS DECIMAL) is too strict on INSERT in strict mode

Details

    • Bug
    • Status: Stalled (View Workflow)
    • Major
    • Resolution: Unresolved
    • 5.5(EOL), 10.0(EOL), 10.1(EOL), 10.2(EOL), 10.3(EOL), 10.4(EOL), 10.5
    • 10.5
    • OTHER
    • 10.1.8-3

    Description

      This script:

      SET sql_mode='STRICT_ALL_TABLES';
      DROP TABLE IF EXISTS t1;
      CREATE TABLE t1 (a DECIMAL);
      INSERT INTO t1 VALUES(CAST('' AS DECIMAL));

      returns an error:

      ERROR 1292 (22007): Truncated incorrect DECIMAL value: ''

      This looks wrong.

      I wrote an explicit CAST, so I expect:

      • CAST to return 0 with a warning
      • INSERT to write 0 into the table normally, as I'm actually inserting the CAST result, which is 0.

      Attachments

        Issue Links

          Activity

            Hmm, the was not pushed for some reasons.
            It seems it was closed in a mistake.
            Reopening.

            bar Alexander Barkov added a comment - Hmm, the was not pushed for some reasons. It seems it was closed in a mistake. Reopening.

            People

              bar Alexander Barkov
              bar Alexander Barkov
              Votes:
              1 Vote for this issue
              Watchers:
              2 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.