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

STR_TO_DATE is inconsistent regarding precision

    XMLWordPrintable

Details

    • Bug
    • Status: Open (View Workflow)
    • Minor
    • Resolution: Unresolved
    • 5.3.12, 5.5.36, 10.0.10
    • 5.5(EOL)
    • None
    • None

    Description

      This SQL script:

      DROP TABLE IF EXISTS t1;
      CREATE TABLE t1 (date VARCHAR(32), format VARCHAR(30));
      INSERT INTO t1 VALUES ('2003-01-02 10:11:12','%Y-%m-%d %H:%i:%S');
      SELECT str_to_date(date, format) AS a, coalesce(str_to_date(date, format)) AS b FROM t1;

      returns the following results:

      +---------------------+----------------------------+
      | a                   | b                          |
      +---------------------+----------------------------+
      | 2003-01-02 10:11:12 | 2003-01-02 10:11:12.000000 |
      +---------------------+----------------------------+

      Notice, "a" returns 0 fractional digits, while "b" returns 6 fractional digits.

      The data type for the both expressions is DATETIME(6).
      "a" should return 6 digits, like "b" does.

      Attachments

        Activity

          People

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