compiler: Preserve matching sql table column types#2759
Open
sjh9714 wants to merge 1 commit into
Open
Conversation
Signed-off-by: jinhyuk9714 <jinhyuk9714@gmail.com>
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
Fixes #1960.
SQL table columns with an explicit type label equal to the column key, such as
date: date, were compiled as if the type were implicit and ended up with an empty rendered type. This keeps matching explicit scalar labels while preserving empty types for implicit columns likeidand map-only columns likecreated {constraint: primary_key}.Changes
date: date, an implicitid, and a constraint-only column.Testing
go test ./d2compiler -run TestCompile/sql-column-type-matches-name -count=1failed before the fix withexpected: "date",actual: "".TESTDATA_ACCEPT=1 GOTOOLCHAIN=go1.25.0 go test ./d2compiler -run TestCompile/sql-column-type-matches-name -count=1GOTOOLCHAIN=go1.25.0 go test ./d2compiler -run TestCompile/sql-column-type-matches-name -count=1GOTOOLCHAIN=go1.25.0 go test ./e2etests -run TestE2E/stable/sql_table_tooltip_animated -count=1GOTOOLCHAIN=go1.25.0 go test ./d2compiler -run 'TestCompile/sql' -count=1GOTOOLCHAIN=go1.25.0 go test ./d2compiler -count=1git diff --checkNote: I used Codex while preparing this change, and I reviewed the final diff and ran the listed checks locally.