GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Align DDL traversal and validation with active AST definitions by minleejae · Pull Request #2778 · JSQLParser/JSqlParser

Conversation

@minleejae

@minleejae minleejae commented Oct 12, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

Purpose

Make table discovery and metadata validation follow the DDL body actually rendered after AST mutation. For example, adding a column to an ALTER action that still stores an earlier foreign key renders ADD added INT, but currently table discovery and validation still use the inactive foreign table and key columns.

Current design (As-is)

Rendering selects one body, while traversal and metadata validation independently visit stored definitions, defaults and column options. This leaks inactive state into consumers. A CHECK option changed to FOREIGN_OPTIONS can also retain its old constraint node and incorrectly traverse that expression.

Target design (To-be)

  • Share active-definition selection through getActiveTableDefinition() and the body-selection hooks introduced in Fix ALTER deparser dispatch for inactive column metadata #2770.
  • Traverse active defaults, columns, constraints and indexes, while preserving the expression/table children of specialized ALTER bodies.
  • Validate only the selected structured definitions and key columns. Keep stored metadata accessible through existing getters.
  • Respect the active ColumnOption.Kind, partial legacy constraint headers, identity actions and dedicated primary-key/partition/relation bodies.
  • Document the stored-versus-active distinction and dispatch hooks for custom subclasses.

This refactoring changes consumer behavior after AST mutation; it adds no SQL syntax or database validity rules.

Rebase

#2770, which this PR previously included, and #2776 are now merged. The branch is rebased onto master (bdf8ac31) and contains only its own commit.

  • The validator conflict with Separate ALTER key definitions from column drop targets #2771 is resolved using Separate ALTER key definitions from column drop targets #2771's state: drop targets and the UNIQUE index name are validated through Separate ALTER key definitions from column drop targets #2771's checks, now applied to the active definition. The legacy PK/UK checks are removed because Separate ALTER key definitions from column drop targets #2771 no longer stores that state.
  • The conflict with Fix index definition and reference roles in ALTER validation #2776 in AlterValidator.validateIndex keeps both changes. Fix index definition and reference roles in ALTER validation #2776's role-based name checks (the old name of RENAME INDEX/KEY must exist; a name introduced by ADD or RENAME is not looked up) apply when the index is the active definition or the action is a rename. Key columns are validated only for the active index definition.

Validation

  • Regression tests compare rendered SQL, custom traversal callbacks, table-name discovery and metadata validation after mutations. Active foreign keys and specialized bodies retain their required children; inactive definitions stay accessible without being visited.
  • Java 17 offline Gradle spotlessApply check after rebasing onto master (bdf8ac31): 10,368 tests, 10,343 passed, 25 skipped, zero failures/errors. Grammar, Checkstyle, PMD, SpotBugs and coverage checks pass.
  • Default PMD comparison against the previous base (066f581e): existing findings decrease from 13 to 8, with no new findings or suppression/threshold changes.

Integration validation

Applied #2770, #2771 and all four follow-ups (#2775–#2778) together on master (066f581e), resolving overlapping validator edits while preserving their respective behavior. The integrated build passes Java 17 offline Gradle spotlessApply check: 10,141 tests, 10,116 passed, 25 skipped, zero failures/errors. The combined ALTER validator has zero findings under the default PMD complexity and field-placement rules.

Replayed 882 previously DB-validated MySQL/PostgreSQL DDL fixtures: 875 pass and the same seven existing parse gaps remain. SQL output, reparsing and AST node-type sets match the preceding integration baseline, with no new differences. This replay did not rerun the databases.

The published head passes grammar checks, Gradle and Maven on Ubuntu/Windows/macOS, and Codacy. Deployment-only jobs are skipped as expected for a PR.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
This was referenced Oct 12, 2026
Fix editable key columns after clearing legacy names #2775
Merged
Fix index definition and reference roles in ALTER validation #2776
Merged
Make column option token access consistent and explicit #2777
Merged
@minleejae
minleejae force-pushed the refactor/ddl-active-traversal-20261011 branch from 2bdcea0 to 6c00a12 Compare October 13, 2026 03:32
@manticore-projects

manticore-projects commented Oct 13, 2026

Copy link
Copy Markdown
Contributor

Sorry, conflict.

minleejae reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@minleejae
Traverse and validate active DDL payloads
196cb60
Signed-off-by: minleejae <[email protected]>
@minleejae
minleejae force-pushed the refactor/ddl-active-traversal-20261011 branch from 6c00a12 to 196cb60 Compare October 14, 2026 07:50
This was referenced Oct 14, 2026
Parse PostgreSQL Unicode escape string constants #2820
Merged
Expose MySQL table and partition comments as string values #2821
Merged
Parse COMMENT ON operators, operator classes, text search objects and large objects #2822
Merged
Parse MySQL SHOW FULL COLUMNS, SHOW TABLE STATUS and SHOW CREATE statements #2824
Merged
Model MySQL CREATE FUNCTION and PROCEDURE characteristics #2823
Merged
@manticore-projects
manticore-projects merged commit f3d2d83 into JSQLParser:master Oct 17, 2026
10 checks passed

Uh oh!

There was an error while loading. Please reload this page.

@manticore-projects

manticore-projects commented Oct 17, 2026

Copy link
Copy Markdown
Contributor

Thank you!

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@minleejae @manticore-projects
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.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.