Skip to content

Support dialect-specific CREATE INDEX definitions - #2586

Merged
manticore-projects merged 1 commit into
JSQLParser:masterfrom
minleejae:feat/dialect-index-definitions
Sep 11, 2026
Merged

Support dialect-specific CREATE INDEX definitions#2586
manticore-projects merged 1 commit into
JSQLParser:masterfrom
minleejae:feat/dialect-index-definitions

Conversation

@minleejae

Copy link
Copy Markdown
Contributor

CREATE INDEX rejects Spanner's UNIQUE NULL_FILTERED combination, SQL Server's UNIQUE NONCLUSTERED combination, and the schema-qualified PostgreSQL collation/operator-class example in #1994. This change parses and preserves these definitions with an explicit dialect:

  • SPANNER: keep uniqueness in Index.getType() and null filtering in CreateIndex.isNullFiltered().
  • SQLSERVER: reuse Index.getClustering() independently of uniqueness.
  • POSTGRESQL: accept qualified collation/operator-class names and bare function keys. Store key attributes once in their structured fields so AST edits are reflected in SQL output.

Share key/option expression rendering between the AST and deparser, and route CREATE INDEX through the common definition traversal used by visitors, table discovery and validation. Preserve the default parser's single-type and raw key-parameter behavior, including MySQL prefix lengths.

Fixes #652. Addresses the index example in #1994 and the CREATE UNIQUE NONCLUSTERED INDEX failure in #1563. This does not resolve all failures in the Sakila scripts linked from #1563. A regression test also covers a PostgreSQL function followed by an index and another statement.

Validation:

  • Gradle check: 6,272 tests, no failures, 25 skipped; formatting and static checks passed. The local formatter ratchet uses the upstream base commit because the fork's origin/master is behind upstream.
  • Maven verify passed.
  • Coverage includes dialect isolation, modifier combinations, AST edits, expression visitors/deparsers, validation and statement boundaries.

Syntax references: Spanner, SQL Server, PostgreSQL.

@manticore-projects
manticore-projects merged commit 4be195b into JSQLParser:master Sep 11, 2026
9 checks passed
@manticore-projects

Copy link
Copy Markdown
Contributor

thank you!

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.

Indices with multiple parameters are not parsed correctly

2 participants