Skip to content

Fix(table_diff): Widen the data types that --decimals applies to#5542

Merged
erindru merged 1 commit intomainfrom
erin/table-diff-decimal
Oct 14, 2025
Merged

Fix(table_diff): Widen the data types that --decimals applies to#5542
erindru merged 1 commit intomainfrom
erin/table-diff-decimal

Conversation

@erindru
Copy link
Collaborator

@erindru erindru commented Oct 14, 2025

Prior to this, sqlmesh table_diff ... --decimals n would:

  • Only apply --decimals to columns of type DOUBLE or FLOAT. I believe the reason was historical - it is assumed that floating point numbers are always awkward so you have to round them to some fixed length out of necessity, but if you're using fixed point numbers then you don't need this so the whole number should be compared
  • Assume that every database has a ROUND function that works with floating point types (Postgres is a notable example that does not)

So this PR:

  • Updates --decimals to apply to any column that can contain a fixed or floating point decimal
  • Uses EngineAdapter._normalize_decimal_value to produce the value to compare instead of wrapping it in ROUND() and hoping that is valid on the target database

@erindru erindru force-pushed the erin/table-diff-decimal branch from ef54177 to 55f376f Compare October 14, 2025 19:12
@erindru erindru merged commit 7337133 into main Oct 14, 2025
36 checks passed
@erindru erindru deleted the erin/table-diff-decimal branch October 14, 2025 19:53
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.

2 participants