Skip to content

[fix](doc) milliseconds-sub.md en: overflow example needs +1500 delta, not -1500#3812

Open
boluor wants to merge 1 commit into
apache:masterfrom
boluor:fix/milliseconds-sub-en-no-error
Open

[fix](doc) milliseconds-sub.md en: overflow example needs +1500 delta, not -1500#3812
boluor wants to merge 1 commit into
apache:masterfrom
boluor:fix/milliseconds-sub-en-no-error

Conversation

@boluor
Copy link
Copy Markdown
Contributor

@boluor boluor commented May 26, 2026

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

  • Run both forms on a 4.1.1 cluster — only the +1500 form raises the documented error.
  • No other change.

🤖 Generated with Claude Code

…-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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant