Skip to content

compiler: keep sql_table column types that match the column name - #2950

Open
fguinez wants to merge 2 commits into
d2lang:masterfrom
fguinez:fix/sql-column-type-matches-name
Open

fguinez wants to merge 2 commits into
d2lang:masterfrom
fguinez:fix/sql-column-type-matches-name

Conversation

@fguinez

@fguinez fguinez commented Oct 23, 2026 •

Copy link
Copy Markdown

Fixes #1960

date: date in a sql_table rendered the column with an empty type. A column's
label defaults to its name, so the compiler blanked the type whenever the two
matched, even when the label was written explicitly.

The compiler now records which labels were set explicitly and only blanks the
type for columns without one. This also covers a label and its constraint
written in separate statements:

key: key
key {constraint: unique}

shape: class has the same check in compileClass. That case is tracked in #2951.

A column's label defaults to its name, so compileSQLTable blanked the
type whenever the two matched, including when the label was set
explicitly (date: date). Record explicit labels and only blank the type
when there is none.

Fixes d2lang#1960
Copilot AI lite review requested due to automatic review settings October 23, 2026 02:06

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.

This branch has not been deployed

No deployments
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.

when label in sql_table is set to same as key, it doesn't work

2 participants