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

Wrong result from ADDDATE(IFNULL(baddate))

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Minor
    • Resolution: Not a Bug
    • 10.0.7
    • N/A
    • Temporal Types
    • None

    Description

      mysql> SELECT ADDDATE(TIMESTAMP'0000-00-00 00:20:12',0) as add1, ADDDATE(IFNULL(TIMESTAMP(NULL),TIME'00:20:12'),0) as indirect,IFNULL(TIMESTAMP(NULL),TIME'00:20:12') as add2;
      +------+---------------------+---------------------+
      | add1 | indirect            | add2                |
      +------+---------------------+---------------------+
      | NULL | 0000-00-00 00:20:12 | 0000-00-00 00:20:12 |
      +------+---------------------+---------------------+
      1 row in set, 1 warning (0.00 sec)
       

      ADDDATE(TIMESTAMP'0000-00-00 00:20:12',0) correctly returns NULL,
      because it requires a value date.

      However, ADDDATE() erroneously returns a non-NULL if the value
      comes indirectly, e.g. from the IFNULL function.
      The expected result of "add2" should also be NULL.

      Attachments

        Activity

          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.