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

DOUBLE(0,0) is now converted to DOUBLE - unexpected behavior

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Minor
    • Resolution: Won't Fix
    • 10.1.2
    • N/A
    • Parser
    • None

    Description

      As discussed, the following revision has an unexpected side-effect

      * commit 227510e039b4ec6bff3096a4b9b39847551dab1a
      | Author: Sergei Golubchik <serg@mariadb.org>
      | Date:   Sat Nov 8 17:37:19 2014 +0100
      | 
      |     parser cleanup: don't store field properties in LEX, use Create_field directly
      |     
      |     length/dec/charset are still in LEX, because they're also used
      |     for CAST and dynamic columns.
      |     
      |     also
      |     1. fix "MDEV-7041 COLLATION(CAST('a' AS CHAR BINARY)) returns a wrong result"
      |     2. allow BINARY modifier in stored function RETURN clause
      |     3. allow "COLLATION without CHARSET" in SP/SF (parameters, RETURN, DECLARE)
      |     4. print correct variable name in error messages for stored routine parameters

      Before this change, column definition c DOUBLE(0,0) was rejected with ER_TOO_BIG_DISPLAYWIDTH:

      MariaDB [test]> create table t1 (c double(0,0));
      ERROR 1439 (42000): Display width out of range for 'c' (max = 255)

      Since this revision, it is accepted and the column is stored as DOUBLE:

      MariaDB [test]> create table t1 (c double(0,0));
      Query OK, 0 rows affected (0.55 sec)
       
      MariaDB [test]> insert into t1 values (1234567890123456.1234567890123456);
      Query OK, 1 row affected (0.06 sec)
       
      MariaDB [test]> select * from t1;
      +----------------------+
      | c                    |
      +----------------------+
      | 1.234567890123456e15 |
      +----------------------+
      1 row in set (0.00 sec)
       
      MariaDB [test]> show create table t1 \G
      *************************** 1. row ***************************
             Table: t1
      Create Table: CREATE TABLE `t1` (
        `c` double DEFAULT NULL
      ) ENGINE=InnoDB DEFAULT CHARSET=latin1
      1 row in set (0.00 sec)

      I don't see anything bad in it, but since it's unexpected it is suspicious.

      Attachments

        Issue Links

          Activity

            People

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

              Dates

                Created:
                Updated:
                Resolved:

                Git Integration

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