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

No warning is produced on microsecond precision truncation, as it is done for other data types

    XMLWordPrintable

Details

    • Bug
    • Status: Open (View Workflow)
    • Minor
    • Resolution: Unresolved
    • 5.5.25, 5.3.7
    • 5.5(EOL)
    • None
    • None

    Description

      When a value with microseconds is truncated while being inserted into a time column, it does not cause a warning, as it happens in the similar situation with other data types:

      Microseconds truncated, no warning:

      CREATE TABLE t (c1 TIME(3));
      INSERT INTO t VALUES ('10:11:12.12345');
      SELECT * FROM t;
      c1
      10:11:12.123

      Fractional part of a decimal value truncated, a warning is produced:

      CREATE TABLE t (d DECIMAL(5,3));
      INSERT INTO t VALUES (12.34567);
      Warnings:
      Note	1265	Data truncated for column 'd' at row 1
      SELECT * FROM t;
      d
      12.346

      It might cause a confusion, especially if a user does not expect that the server knows about microseconds and takes them into account:

      CREATE TABLE t (c1 TIME);
      INSERT INTO t VALUES ('10:11:12.123');
      SELECT * FROM t WHERE c1 = '10:11:12.123';
      c1
      DROP TABLE t;

      The empty result set is understandable considering that TIME is actually TIME(0), and that the inserted value is silently truncated, while in the select the string literal is converted into a temporal value with microseconds; but it is not obvious at all without a warning about truncation.

      Attachments

        Issue Links

          Activity

            People

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