dolthub / dolthub/dolt

`extract` behavior for `true` differs from MySQL for some units

Open
#10,087 1 comment 0 reactions 0 assignees View on GitHub
bug correctness
Dominant language
Go
Stars
24.4k
Forks
873
Avg merge
1d 9h
Merged PRs (30d)
121

Description

MySQL
```
mysql> select extract(day_microsecond from true);
+------------------------------------+
| extract(day_microsecond from true) |
+------------------------------------+
| 1000000 |
+------------------------------------+
1 row in set (0.00 sec)

mysql> select extract(day_second from true);
+-------------------------------+
| extract(day_second from true) |
+-------------------------------+
| 1 |
+-------------------------------+
1 row in set (0.00 sec)

mysql> select extract(day_minute from true);
+-------------------------------+
| extract(day_minute from true) |
+-------------------------------+
| 0 |
+-------------------------------+
1 row in set (0.00 sec)

mysql> select extract(day_hour from true);
+-----------------------------+
| extract(day_hour from true) |
+-----------------------------+
| 0 |
+-----------------------------+
1 row in set (0.00 sec)

mysql> select extract(second_microsecond from true);
+---------------------------------------+
| extract(second_microsecond from true) |
+---------------------------------------+
| 1000000 |
+---------------------------------------+
1 row in set (0.00 sec)

mysql> select extract(minute_microsecond from true);
+---------------------------------------+
| extract(minute_microsecond from true) |
+---------------------------------------+
| 1000000 |
+---------------------------------------+
1 row in set (0.00 sec)

mysql> select extract(minute_second from true);
+----------------------------------+
| extract(minute_second from true) |
+----------------------------------+
| 1 |
+----------------------------------+
1 row in set (0.00 sec)

mysql> select extract(hour_microsecond from true);
+-------------------------------------+
| extract(hour_microsecond from true) |
+-------------------------------------+
| 1000000 |
+-------------------------------------+
1 row in set (0.00 sec)

mysql> select extract(hour_second from true);
+--------------------------------+
| extract(hour_second from true) |
+--------------------------------+
| 1 |
+--------------------------------+
1 row in set (0.00 sec)

mysql> select extract(hour_minute from true);
+--------------------------------+
| extract(hour_minute from true) |
+--------------------------------+
| 0 |
+--------------------------------+
1 row in set (0.00 sec)

mysql> select extract(microsecond from true);
+--------------------------------+
| extract(microsecond from true) |
+--------------------------------+
| 0 |
+--------------------------------+
1 row in set (0.00 sec)

mysql> select extract(second from true);
+---------------------------+
| extract(second from true) |
+---------------------------+
| 1 |
+---------------------------+
1 row in set (0.00 sec)

mysql> select extract(minute from true);
+---------------------------+
| extract(minute from true) |
+---------------------------+
| 0 |
+---------------------------+
1 row in set (0.00 sec)

mysql> select extract(hour from true);
+-------------------------+
| extract(hour from true) |
+-------------------------+
| 0 |
+-------------------------+
1 row in set (0.00 sec)
```

In Dolt, all these queries return `NULL` with a warning `Warning (Code 1292): Incorrect datetime value: 'true'`

Contributor guide

No contributing guide indexed for this repository

Research direction

Reproduce the listed EXTRACT queries in Dolt and compare each result and warning with MySQL. Trace the EXTRACT implementation and its handling of the boolean value true; done means the listed units return the corresponding MySQL-compatible values instead of NULL with warning 1292.

Written by the indexing model from the issue text.

Assessment

Tech stack
mysql, sql
Domain
databases
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.