[fix](doc) milliseconds-sub.md en: overflow example needs +1500 delta, not -1500#3812
Open
boluor wants to merge 1 commit into
Open
[fix](doc) milliseconds-sub.md en: overflow example needs +1500 delta, not -1500#3812boluor wants to merge 1 commit into
boluor wants to merge 1 commit into
Conversation
…-1500
The "calculation result exceeds the datetime range" example invoked
`MILLISECONDS_SUB('0000-01-01', -1500)` and claimed it raises an
overflow error. But SUB(-1500ms) on '0000-01-01' is equivalent to
ADD(+1500ms) and lands on '0000-01-01 00:00:01.500000' — well within
the valid range. The doc had the sign of the delta backwards.
To actually overflow, the example needs `MILLISECONDS_SUB('0000-01-01',
1500)` (positive delta), which moves the timestamp before 0000-01-01
and raises the documented out-of-range error. Also flip the error
text's function name from 'milliseconds_add' to 'millisecond_add' to
match what 4.x actually prints (singular form). ZH already has the
+1500 form.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Doc page (4.x): `scalar-functions/date-time-functions/milliseconds-sub.md` (EN).
The "calculation result exceeds the datetime range" example claimed:
```sql
SELECT MILLISECONDS_SUB('0000-01-01', -1500);
ERROR 1105 (HY000): ... -1500 out of range
```
But `MILLISECONDS_SUB(date, -1500)` is equivalent to `MILLISECONDS_ADD(date, 1500)` and produces a valid `0000-01-01 00:00:01.500000` — not an error. The doc had the sign of the delta backwards. The ZH counterpart already uses `+1500`, which correctly underflows below 0000-01-01.
Also flip the error string's function name from `milliseconds_add` to `millisecond_add` (singular form), which is what 4.x actually prints in the underlying error.
Verification
```
mysql> SELECT MILLISECONDS_SUB('0000-01-01', -1500);
+---------------------------------------+
| MILLISECONDS_SUB('0000-01-01', -1500) |
+---------------------------------------+
| 0000-01-01 00:00:01.500000 |
+---------------------------------------+
mysql> SELECT MILLISECONDS_SUB('0000-01-01', 1500);
ERROR 1105 (HY000): errCode = 2, detailMessage = (127.0.0.1)[E-218]Operation millisecond_add of 0000-01-01 00:00:00, -1500 out of range
```
Test plan
🤖 Generated with Claude Code