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

Wrong result from ADDDATE(IFNULL(baddate))

    Details

    • Type: Bug
    • Status: Open
    • Priority: Minor
    • Resolution: Unresolved
    • Affects Version/s: 10.0.7
    • Fix Version/s: 10.0
    • Component/s: None
    • Labels:
      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.

        Gliffy Diagrams

          Attachments

            Activity

            There are no comments yet on this issue.

              People

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

                Dates

                • Created:
                  Updated: