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

Unexpected and/or excessive warnings upon cast in default

    XMLWordPrintable

Details

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

    Description

      CREATE TABLE t (a INT, b CHAR(8), KEY(b));
      INSERT INTO t VALUES (1,'x');
      ALTER TABLE t MODIFY a DECIMAL(65,10) DEFAULT(-CAST(POW(10,20) AS UNSIGNED));
      SELECT * FROM t;
       
      DROP TABLE t;
      

      10.4 9856bb42

      CREATE TABLE t (a INT, b CHAR(8), KEY(b));
      INSERT INTO t VALUES (1,'x');
      ALTER TABLE t MODIFY a DECIMAL(65,10) DEFAULT(-CAST(POW(10,20) AS UNSIGNED));
      Warnings:
      Note	1916	Got overflow when converting '1e20' to UNSIGNED BIGINT. Value truncated
      Note	1916	Got overflow when converting '1e20' to UNSIGNED BIGINT. Value truncated
      Note	1916	Got overflow when converting '1e20' to UNSIGNED BIGINT. Value truncated
      Note	1916	Got overflow when converting '1e20' to UNSIGNED BIGINT. Value truncated
      Note	1916	Got overflow when converting '1e20' to UNSIGNED BIGINT. Value truncated
      SELECT * FROM t;
      a	b
      1.0000000000	x
      Warnings:
      Note	1916	Got overflow when converting '1e20' to UNSIGNED BIGINT. Value truncated
      DROP TABLE t;
      

      There are several strange things here.
      First, upon ALTER, should it really a Note (not an error), given that it's a strict mode.
      Second, why are there five of them upon ALTER, even though there is only one row in the table, and even that row doesn't require default value upon ALTER.
      Third and may be the strangest, why is there a warning upon SELECT, select doesn't use DEFAULT.

      Attachments

        Issue Links

          Activity

            People

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