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

Inconsistent warnings when inserting a DATETIME-alike data into a TIME column

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Minor
    • Resolution: Fixed
    • 5.1.67, 5.2.14, 5.3.12, 5.5.36, 10.0.10
    • N/A
    • Temporal Types
    • None

    Description

      mysql> DROP TABLE IF EXISTS t1;
      Query OK, 0 rows affected (0.03 sec)
       
      mysql> CREATE TABLE t1 (from_str TIME, from_int TIME,from_dec TIME, from_double TIME);
      Query OK, 0 rows affected (0.15 sec)
       
      mysql> INSERT INTO t1 VALUES ('2001-01-01 10:20:30',20010101102030,20010101102030.0,20010101102030e0);
      Query OK, 1 row affected, 4 warnings (0.01 sec)
       
      mysql> SHOW WARNINGS;
      +---------+------+--------------------------------------------------+
      | Level   | Code | Message                                          |
      +---------+------+--------------------------------------------------+
      | Note    | 1265 | Data truncated for column 'from_str' at row 1    |
      | Warning | 1265 | Data truncated for column 'from_int' at row 1    |
      | Warning | 1265 | Data truncated for column 'from_dec' at row 1    |
      | Warning | 1265 | Data truncated for column 'from_double' at row 1 |
      +---------+------+--------------------------------------------------+
      4 rows in set (0.00 sec)
       
      mysql> SELECT * FROM t1;
      +----------+----------+----------+-------------+
      | from_str | from_int | from_dec | from_double |
      +----------+----------+----------+-------------+
      | 10:20:30 | 10:20:30 | 10:20:30 | 10:20:30    |
      +----------+----------+----------+-------------+
      1 row in set (0.00 sec)

      Notice, string gives a note while the numeric types give warnings.

      A note seems to be the most appropriate in all cases.

      Attachments

        Activity

          People

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