[Bug]: CURTIME()/CURRENT_TIME() accept fractional-seconds precision > 6 instead of MySQL error 1426

Open
#33,331 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

  • #33332 by @MatrixAdventurer — closed without merging

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
35/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Stale
Tech stack
go, sql
Domain
databases

Research direction

Start by locating builtInCurrentTime, which the issue identifies as clamping fractional precision, and compare its validation with the sibling time functions that already return MySQL error 1426. Reproduce with SELECT CURTIME(7); and SELECT CURRENT_TIME(10);; done means both reject precision above 6 with the expected error. A linked pull request is already closed, so check its discussion and changes for context.

Written by the indexing model from the issue text.

Description

kind/bug
Is there an existing issue for the same bug?
  • I have checked the existing issues (searched curtime, current_time precision, Too-big precision).
Branch Name

main (5485cbc3)

Describe the bug

CURTIME(fsp) / CURRENT_TIME(fsp) silently accept a fractional-seconds precision above 6 and return a TIME value. The sibling functions NOW(), SYSDATE(), CURRENT_TIMESTAMP(), UTC_TIME() and UTC_TIMESTAMP() already reject it with MySQL error 1426.

builtInCurrentTime clamps the scale into [0, 6] instead of validating it.

Steps to reproduce
SELECT CURTIME(7);
SELECT CURRENT_TIME(10);
SELECT NOW(7);
Expected behavior (MySQL 8.0)
SELECT CURTIME(7);       -- ERROR 1426 (42000): Too-big precision 7 specified for 'curtime'. Maximum is 6.
SELECT CURRENT_TIME(10); -- ERROR 1426 (42000): Too-big precision 10 specified for 'curtime'. Maximum is 6.
SELECT NOW(7);           -- ERROR 1426 (42000): Too-big precision 7 specified for 'now'. Maximum is 6.
Actual behavior (MatrixOne main 5485cbc3)
SELECT CURTIME(7);       -- returns a TIME, e.g. 10:20:07
SELECT CURRENT_TIME(10); -- returns a TIME, e.g. 10:20:07
SELECT NOW(7);           -- ERROR 1426: Too-big precision 7 specified for 'now'. Maximum is 6.  (already correct)
Additional information

Single-node mo-service -launch etc/launch/launch.toml.

本操作由 LW 授权的 Grok Bot 智能体执行。

Dominant language
Go
Stars
1.9k
Forks
312
Avg merge
22h 59m
Merged PRs (30d)
736

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from matrixorigin/matrixone

All issues in matrixorigin/matrixone

Similar issues

More Go issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.