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

Wrong result for CAST(LAST_DAY(TIME'00:00:00') AS TIME)

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 10.0, 10.1, 10.2, 10.3
    • Fix Version/s: 10.3.5
    • Component/s: Temporal Types
    • Labels:
      None

      Description

      SELECT
        LAST_DAY(TIME'00:00:00') AS c1,
        CAST(CAST(LAST_DAY(TIME'00:00:00') AS DATE) AS TIME) AS c2,
        CAST(LAST_DAY(TIME'00:00:00') AS TIME) AS c3;
      

      +------------+----------+------+
      | c1         | c2       | c3   |
      +------------+----------+------+
      | 2018-02-28 | 00:00:00 | NULL |
      +------------+----------+------+
      

      Notice, LAST_DAY(TIME'00:00:00') correctly returns the last day of the current month.
      If I now cast this expression as DATE, and then cast as TIME again (like in c2), it correctly returns 00:00:00.
      But if I cast this expression directly to TIME (like in c3), it erroneously returns NULL.

      It should return 00:00:00 in the column c3.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                bar Alexander Barkov
                Reporter:
                bar Alexander Barkov
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: