Repository navigation
Fix GH-16910: Fractional seconds truncated in prepared statements - #24467
Open
ojuschugh1 wants to merge 2 commits into
Open
ojuschugh1 wants to merge 2 commits into
ojuschugh1 wants to merge 2 commits into
Conversation
ojuschugh1
requested review from
SakiTakamachi,
bukka and
kamil-tekiela
as code owners
October 20, 2026 19:19
Author
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.
Fixes #16910
The problem was that
ps_fetch_time()andps_fetch_datetime()only printsecond_partwhendecimalsis 1 to 6, the check added for bug #76386. MariaDB reportsAUTO_SEC_PART_DIGITS(39) when the precision isn't known up front, for example forFROM_UNIXTIME('1992.1'), so prepared statements dropped the fraction that the text protocol returns.I made any
decimalsabove 6, the not-fixed sentinel (39 in MariaDB, 31 in MySQL), print six digits whensecond_partis non-zero and none otherwise, as MariaDB Connector/C does for 39, which gives the same strings as the text protocol.ps_fetch_time()gets the same change, though on MariaDB 13.0.2 I only got 39 forFROM_UNIXTIME()(TIMESTAMP) results.The test compares the text and binary protocol results and skips unless the server reports 39 for
FROM_UNIXTIME(). It fails without the fix on MariaDB 13.0.2 and skips on MySQL 8.4.13, and the other ext/mysqli, ext/pdo_mysql and ext/mysqlnd tests give the same results with and without the fix on both servers.