Repository navigation
feat(mssql): show precision/scale for decimal/numeric and length for char/nchar/binary - #883
Open
Tokyohenjin wants to merge 4 commits into
Open
Tokyohenjin wants to merge 4 commits into
Tokyohenjin wants to merge 4 commits into
Conversation
…es to `convertColumnType` * `convertColumnType` - Reflect precision and scale for char, binary, nchar, decimal, and numeric column types.
Tokyohenjin
marked this pull request as ready for review
October 22, 2026 13:59
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.
Summary
The MSSQL driver currently documents
decimalandnumericcolumns without their precision and scale, and fixed-lengthchar,ncharandbinarycolumns without their length. For example, adecimal(9,2)column appears as justdecimal, andchar(5)aschar. The variable-length types (varchar,nvarchar,varbinary) already include their length, so this makes the output consistent.Changes
analyzeTablenow also readssys.columns.precisionandsys.columns.scale.convertColumnTypeformats:decimal/numericasdecimal(p,s)/numeric(p,s)char/binaryaschar(n)/binary(n)ncharasnchar(n), halvingmax_lengththe same waynvarchardoesTestColumnTypePrecisionAndScale, covering explicit precision/scale, the implicitdecimal(18,0)default, and the fixed-length types.Behavior change
Generated docs for existing MSSQL schemas will change wherever these types appear. In particular, a column declared as bare
decimalwill now show asdecimal(18,0), because the values come fromsys.columnsrather than the DDL text.Samples
sample/mssqlis unaffected, sincetestdata/ddl/mssql.sqldoesn't use any of these types.sample/azuresqlneeds regenerating: threedecimalcolumns intestdata/ddl/azuresql.sqlwill now render asdecimal(10,2)/decimal(12,2). I couldn't build the CLI locally due to local IT restrictions. Sorry for the extra step!sample/azuresqlis regenerated in commit 1abe749 and shows the updated values in tables and SVGs.Testing
go test -tags mssql ./drivers/mssql/passes against the local SQL Server container.