Skip to content

Fix accumulating indentation in CREATE TABLE columns - #906

Open
ryanchou1994 wants to merge 1 commit into
andialbrecht:masterfrom
ryanchou1994:fix/create-table-reindent
Open

ryanchou1994 wants to merge 1 commit into
andialbrecht:masterfrom
ryanchou1994:fix/create-table-reindent

Conversation

@ryanchou1994

Copy link
Copy Markdown

CREATE TABLE columns with constraints such as NOT NULL can be split into several IdentifierList groups. Reindent currently anchors each group to its constraint, so each following column moves farther to the right. Anchor these lists to the column-definition parenthesis instead.

The change is limited to space-based column alignment in CREATE TABLE; indent_columns, tab indentation, nested function arguments, and CREATE TABLE AS retain their existing behavior. Tests cover several constraints, formatting twice, CTAS, and a following SELECT statement.

Fixes #688.

  • ran the tests (pytest): 512 passed, 2 xfailed, 1 xpassed on Linux Python 3.13
  • all style issues addressed (ruff)
  • changes are covered by tests (5 regression cases fail on the unchanged base)
  • documentation checked; no public API changes

The original issue SQL, including its primary key, formats consistently. The reindent scaling benchmark passes for both the base and this change.

Copilot AI lite review requested due to automatic review settings September 20, 2026 17:41

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.

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.

CREATE TABLE wrong format

2 participants