fix(oracle): NUMBER(p,0) precision-aware mapping (stop silent int narrowing) - #268
Merged
Merged
Conversation
Oracle catalog emits NUMBER(19,0)/NUMBER(38,0) for bigint-width columns, but parse always chose canonical integer, so cross-dialect migrate created Postgres/MySQL int columns and could truncate or reject values. Co-authored-by: huy.phan9 <huyplb@users.noreply.github.com>
huyplb
marked this pull request as ready for review
August 18, 2026 05:47
Contributor
Author
Bugbot couldn't run - usage limit reachedBugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit. A user or team admin can review and increase usage limits in the Cursor dashboard. (requestId: serverGenReqId_73f6ea57-4724-4fe3-b15e-f0e19505f5b9) |
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.
Bug
Oracle catalog types like
NUMBER(19,0)/NUMBER(38,0)(common bigint-width columns) were always parsed as canonicalinteger, so cross-dialect migrate/compare emitted Postgresinteger/ MySQLint/ etc. Values above int32 range could truncate or fail on apply — silent narrowing with no warning.Same-dialect Oracle→Oracle was already safe (
translateTypeno-op).Fix
In
oracle.sql-dialect.tsparseMap fornumber:NUMBER(p,0)with p≤9 →integerbigintdecimal(p,0)NUMBER/NUMBER(p)unchanged (decimal)Tests
Extended Oracle→Postgres type-mapping cases for p=9/10/18/19/38. Full
packages/sqlsuite green (648).Note
Medium Risk
Changes canonical type resolution for common Oracle bigint-width NUMBER columns, affecting emitted DDL on cross-dialect migrate/compare; behavior is intentional and covered by new tests.
Overview
Fixes cross-dialect migrate/compare where Oracle
NUMBER(19,0)andNUMBER(38,0)were parsed as canonical integer, so targets like Postgres gotintegerinstead ofbigintornumeric(p,0)— silent narrowing past int32 with no warning.Oracle
numberparsing inoracle.sql-dialect.tsnow uses precision forNUMBER(p,0): p≤9 →integer, p≤18 →bigint, p>18 →decimal. Scale>0, bareNUMBER, andNUMBER(p)without scale=0 stay decimal.Tests extend Oracle→Postgres expectations for p=9, 10, 18, 19, and 38.
Reviewed by Cursor Bugbot for commit ce75656. Bugbot is set up for automated code reviews on this repo. Configure here.