dolthub / dolthub/dolt

`TIMESTAMPDIFF` should return `null` when zero time is used

Open
#10,398 1 comment 0 reactions 1 assignee Claimed by @angelamayxie View on GitHub
bug correctness
Dominant language
Go
Stars
24.4k
Forks
873
Avg merge
1d 8h
Merged PRs (30d)
120

Description

MySQL
```
mysql> select timestampdiff(microsecond, "0000-00-00", "0000-00-00");
+--------------------------------------------------------+
| timestampdiff(microsecond, "0000-00-00", "0000-00-00") |
+--------------------------------------------------------+
| NULL |
+--------------------------------------------------------+
1 row in set, 1 warning (0.00 sec)

mysql> select timestampdiff(microsecond, "0000-00-00", "9999-12-31");
+--------------------------------------------------------+
| timestampdiff(microsecond, "0000-00-00", "9999-12-31") |
+--------------------------------------------------------+
| NULL |
+--------------------------------------------------------+
1 row in set, 1 warning (0.00 sec)

mysql> select timestampdiff(microsecond, "2020-12-12","0000-00-00");
+-------------------------------------------------------+
| timestampdiff(microsecond, "2020-12-12","0000-00-00") |
+-------------------------------------------------------+
| NULL |
+-------------------------------------------------------+
1 row in set, 1 warning (0.00 sec)

```

Dolt
```
tmp/main*> select timestampdiff(microsecond, "0000-00-00", "0000-00-00");
+--------------------------------------------------------+
| timestampdiff(microsecond, "0000-00-00", "0000-00-00") |
+--------------------------------------------------------+
| 0 |
+--------------------------------------------------------+
1 row in set (0.00 sec)

tmp/main*> select timestampdiff(microsecond, "0000-00-00", "9999-12-31");
+--------------------------------------------------------+
| timestampdiff(microsecond, "0000-00-00", "9999-12-31") |
+--------------------------------------------------------+
| 9223372036854775 |
+--------------------------------------------------------+
1 row in set (0.00 sec)

tmp/main*> select timestampdiff(microsecond, "2020-12-12","0000-00-00");
+-------------------------------------------------------+
| timestampdiff(microsecond, "2020-12-12","0000-00-00") |
+-------------------------------------------------------+
| -9223372036854775 |
+-------------------------------------------------------+
1 row in set (0.00 sec)
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.