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

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

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Major
    • Resolution: Fixed
    • 10.0(EOL), 10.1(EOL), 10.2(EOL), 10.3(EOL)
    • 10.3.5
    • Temporal Types
    • 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

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