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

STR_TO_DATE does not work with UCS2/UTF16/UTF32

Details

    • Bug
    • Status: Closed (View Workflow)
    • Major
    • Resolution: Fixed
    • 10.0.4, 5.5.33a, 5.3.13
    • 10.0.6
    • None

    Description

      STR_TO_DATE returns NULL with a warning in case of a correct input
      in combination with ucs2, utf16, utf16le, or utf32:

      MySQL [test]> set character_set_connection=ucs2; select str_to_date('2001-01-01','%Y-%m-%d');show warnings;
      Query OK, 0 rows affected (0.00 sec)
       
      +--------------------------------------+
      | str_to_date('2001-01-01','%Y-%m-%d') |
      +--------------------------------------+
      | NULL                                 |
      +--------------------------------------+
      1 row in set, 1 warning (0.00 sec)
       
      +---------+------+-------------------------------------------------------+
      | Level   | Code | Message                                               |
      +---------+------+-------------------------------------------------------+
      | Warning | 1411 | Incorrect datetime value: '' for function str_to_date |
      +---------+------+-------------------------------------------------------+
      1 row in set (0.00 sec)

      The expected result is: 2001-01-01.

      Note, MySQL-5.6 demonstrates the same problem.

      Attachments

        Activity

          bar Alexander Barkov created issue -
          bar Alexander Barkov made changes -
          Field Original Value New Value
          Description STR_TO_DATE return NULL with a warning in case of a correct input
          in combination with ucs2, utf16, utf16le, or utf32:

          {code:sql}
          MySQL [test]> set character_set_connection=ucs2; select str_to_date('2001-01-01','%Y-%m-%d');show warnings;
          Query OK, 0 rows affected (0.00 sec)

          +--------------------------------------+
          | str_to_date('2001-01-01','%Y-%m-%d') |
          +--------------------------------------+
          | NULL |
          +--------------------------------------+
          1 row in set, 1 warning (0.00 sec)

          +---------+------+-------------------------------------------------------+
          | Level | Code | Message |
          +---------+------+-------------------------------------------------------+
          | Warning | 1411 | Incorrect datetime value: '' for function str_to_date |
          +---------+------+-------------------------------------------------------+
          1 row in set (0.00 sec)
          {code}

          The expected result is: 2001-01-01.

          Note, MySQL-5.6 demonstrates the same problem.

          STR_TO_DATE returns NULL with a warning in case of a correct input
          in combination with ucs2, utf16, utf16le, or utf32:

          {code:sql}
          MySQL [test]> set character_set_connection=ucs2; select str_to_date('2001-01-01','%Y-%m-%d');show warnings;
          Query OK, 0 rows affected (0.00 sec)

          +--------------------------------------+
          | str_to_date('2001-01-01','%Y-%m-%d') |
          +--------------------------------------+
          | NULL |
          +--------------------------------------+
          1 row in set, 1 warning (0.00 sec)

          +---------+------+-------------------------------------------------------+
          | Level | Code | Message |
          +---------+------+-------------------------------------------------------+
          | Warning | 1411 | Incorrect datetime value: '' for function str_to_date |
          +---------+------+-------------------------------------------------------+
          1 row in set (0.00 sec)
          {code}

          The expected result is: 2001-01-01.

          Note, MySQL-5.6 demonstrates the same problem.

          serg Sergei Golubchik made changes -
          Fix Version/s 10.0.5 [ 13201 ]
          serg Sergei Golubchik made changes -
          Labels upstream
          bar Alexander Barkov made changes -
          Affects Version/s 5.5.34 [ 13500 ]
          Affects Version/s 5.3.13 [ 12602 ]
          bar Alexander Barkov made changes -
          Status Open [ 1 ] In Progress [ 3 ]
          serg Sergei Golubchik made changes -
          Fix Version/s 10.0.6 [ 13202 ]
          Fix Version/s 10.0.5 [ 13201 ]

          Pushed into 5.3, 5.5, 10.0-base.

          bar Alexander Barkov added a comment - Pushed into 5.3, 5.5, 10.0-base.
          bar Alexander Barkov made changes -
          Resolution Fixed [ 1 ]
          Status In Progress [ 3 ] Closed [ 6 ]
          serg Sergei Golubchik made changes -
          Workflow defaullt [ 28326 ] MariaDB v2 [ 42891 ]
          ratzpo Rasmus Johansson (Inactive) made changes -
          Workflow MariaDB v2 [ 42891 ] MariaDB v3 [ 61919 ]
          serg Sergei Golubchik made changes -
          Workflow MariaDB v3 [ 61919 ] MariaDB v4 [ 146900 ]

          People

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