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

Bad value when inserting COALESCE(CURRENT_TIMESTAMP) into a DECIMAL column

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Major
    • Resolution: Fixed
    • 5.5, 10.0, 10.1, 10.2
    • 10.3.0
    • Temporal Types
    • None

    Description

      This script:

      SET timestamp=UNIX_TIMESTAMP('2001-01-01 10:20:30.000000');
      DROP TABLE IF EXISTS t1;
      CREATE TABLE t1 (a DECIMAL(30,0));
      INSERT INTO t1 VALUES (CURRENT_TIMESTAMP(6));
      SELECT * FROM t1;
      

      returns:

      +----------------+
      | a              |
      +----------------+
      | 20010101102030 |
      +----------------+
      

      This is correct.

      Now if I do:

      SET timestamp=UNIX_TIMESTAMP('2001-01-01 10:20:30.000000');
      DROP TABLE IF EXISTS t1;
      CREATE TABLE t1 (a DECIMAL(30,0));
      INSERT INTO t1 VALUES (COALESCE(CURRENT_TIMESTAMP(6)));
      SELECT * FROM t1;
      

      it generates a warning on INSERT, and returns:

      +------+
      | a    |
      +------+
      | 2001 |
      +------+
      

      Attachments

        Issue Links

          Activity

            People

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