Normalize timestamps to millisecond (3-digit) precision across all databases#94
Closed
vmatt wants to merge 12 commits into
Closed
Normalize timestamps to millisecond (3-digit) precision across all databases#94vmatt wants to merge 12 commits into
vmatt wants to merge 12 commits into
Conversation
Integrate sqeleton as local package and add concatenation-too-long error handling
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.
Standardizes timestamp normalization to consistently use 3 fractional digits (milliseconds) across all database backends, instead of the previous behavior which used up to 6 digits (microseconds) or varied per-database.
Problem
When diffing rows between different databases, timestamp comparisons could fail due to inconsistent fractional-second precision in the normalized string representations. Different databases handled timestamp precision differently:
This led to false positives (phantom diffs) when comparing timestamps across heterogeneous database pairs, particularly when one database stored microseconds and another only stored milliseconds.
Changes
All database backends are updated to normalize timestamp strings to 3 fractional digits (
YYYY-MM-DD HH:MI:SS.fff):TIMESTAMP_PRECISION_POS + 3instead of+ coltype.precisionLEFT(); non-rounding path pads toTIMESTAMP_PRECISION_POS + 3instead of+ 6FF6→FF3for rounding path;RPADtarget length reduced from+ 6to+ 3LEFT()andRPAD()both capped at 3 fractional digits usingmin(coltype.precision, 3)convert_timezone('UTC', ...)wrapping, switched totimestamp_ntztypes, and formats output withFF3instead ofFF6Rationale
DATETIMEdefaults to second precision, many systems don't reliably store beyond ms)timestamp_ntzconsistentlyVersion Bump
reladiffversion:0.6.0→0.6.6