Details
-
Bug
-
Status: Confirmed (View Workflow)
-
Minor
-
Resolution: Unresolved
-
10.11, 11.4, 11.8, 12.3, 13.1, 12.3.3
-
Linux x86_64, MariaDB.org Ubuntu 24.04 binary distribution
Description
MariaDB accepts an explicitly requested fractional-seconds precision of 65536 for CURTIME(), UTC_TIME() and UTC_TIMESTAMP(). The functions return values with zero fractional digits instead of rejecting the precision with ER_TOO_BIG_PRECISION (1426).
Steps to reproduce
- Connect to MariaDB 12.3.3.
- Execute each statement separately, in the following order:
SELECT OCTET_LENGTH(CURTIME(65536)) AS curtime_length; |
SELECT OCTET_LENGTH(UTC_TIME(65536)) AS utc_time_length; |
SELECT OCTET_LENGTH(UTC_TIMESTAMP(65536)) AS utc_timestamp_length; |
SELECT OCTET_LENGTH(CURTIME(6)) AS valid_length; |
SELECT CURTIME(7) AS invalid_precision; |
SELECT CAST('12:34:56' AS TIME(65536)) AS cast_precision; |
These statements are read-only and require no setup.
Actual result
The first three statements succeed:
curtime_length
|
8
|
|
|
utc_time_length
|
8
|
|
|
utc_timestamp_length
|
19
|
The valid CURTIME(6) control succeeds and returns a length of 15. The two rejection controls produce the expected errors:
ERROR 1426 (42000): Too big precision specified for 'curtime'. Maximum is 6
|
ERROR 1426 (42000): Too big precision specified for '12:34:56'. Maximum is 6
|
Expected result
Each explicitly requested temporal fractional precision greater than 6 should be rejected with ER_TOO_BIG_PRECISION (1426). In particular, precision 65536 should not be accepted as a zero-fractional-precision value.
The differing treatment of 7 and 65536 indicates that the full-width precision is not preserved through validation for these temporal functions, while the TIME cast correctly rejects 65536.
This occurs when CURTIME, UTC_TIME or UTC_TIMESTAMP is given the exceptional precision value 65536.
Attachments
Issue Links
- relates to
-
MDEV-437 Microseconds: In time functions precision is calculated modulo 256
-
- Closed
-