Skip to content

fix(db): strip MySQL display widths from INTEGER types during export#42

Merged
Lazialize merged 1 commit intomainfrom
fix/26-mysql-integer-spurious-precision
Feb 6, 2026
Merged

fix(db): strip MySQL display widths from INTEGER types during export#42
Lazialize merged 1 commit intomainfrom
fix/26-mysql-integer-spurious-precision

Conversation

@Lazialize
Copy link
Owner

Summary

MySQL's information_schema returns display widths (e.g., 10 for INT, 11 for INT(11)) as numeric_precision. The MySqlTypeMapper::parse_sql_type() was passing these display widths directly as Strata's semantic precision, causing false type-change diffs like INTEGER → INTEGER(10) during round-trip operations (exportgenerate).

Fix: Strip display widths for int/integer and tinyint (non-BOOLEAN) types by setting precision: None instead of using metadata.numeric_precision.

Related Issue

Fixes #26

Type of Change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Refactoring (no functional changes)
  • Documentation update
  • CI/CD or tooling changes

Test Plan

  • Added/updated unit tests
  • Tested manually with PostgreSQL
  • Tested manually with MySQL
  • Tested manually with SQLite

Added regression tests:

  • test_mysql_parse_int_strips_display_width — INT with numeric_precision=10
  • test_mysql_parse_integer_strips_display_width — INTEGER keyword variant
  • test_mysql_parse_int_11_strips_display_width — INT(11) signed default
  • test_mysql_parse_tinyint_non_boolean_strips_display_width — TINYINT with precision ≠ 3
  • test_mysql_int_roundtrip_no_spurious_precision — Full parse → format round-trip

Checklist

  • My code follows the project's coding style
  • I have run cargo fmt and cargo clippy
  • I have added tests that prove my fix/feature works
  • All new and existing tests pass (cargo test)
  • I have updated documentation if needed

MySQL's information_schema returns display widths (e.g., 10 for INT,
11 for INT(11)) as numeric_precision. These display widths were being
incorrectly preserved as Strata's semantic precision, causing false
type-change diffs like "INTEGER → INTEGER(10)" during round-trip
operations (export → generate).

Fixes #26

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@coderabbitai
Copy link

coderabbitai bot commented Feb 6, 2026

Warning

Rate limit exceeded

@Lazialize has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 8 minutes and 0 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/26-mysql-integer-spurious-precision

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes MySQL schema export/import round-trip stability by preventing MySQL information_schema.numeric_precision (which can reflect INTEGER display width) from being mapped into Strata’s semantic ColumnType::INTEGER { precision }, avoiding false type-change diffs like INTEGER → INTEGER(10).

Changes:

  • Strip MySQL display widths for int/integer by always setting ColumnType::INTEGER { precision: None } when parsing.
  • Strip display widths for non-BOOLEAN tinyint by setting precision: None.
  • Add regression tests covering the display-width stripping behavior and a parse→format round-trip assertion.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@Lazialize Lazialize merged commit cd1b787 into main Feb 6, 2026
7 checks passed
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.

export: MySQL INTEGER columns get spurious precision: 10 added

2 participants