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 — fix: accept VISIBLE/INVISIBLE index and column attributes in CREATE TABLE and CREATE INDEX by aparajon · Pull Request #2449 · JSQLParser/JSqlParser

Conversation

@aparajon

@aparajon aparajon commented Aug 5, 2026 •
edited
Loading

Uh oh!

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

Copy link
Copy Markdown
Contributor

Related to #2076

Problem

MySQL 8.0 index and column visibility attributes are valid syntax in CREATE TABLE and CREATE INDEX:

CREATE TABLE t1 (
  id bigint NOT NULL,
  secret varchar(10) INVISIBLE,
  KEY idx_id (id) INVISIBLE
);

CREATE INDEX idx_a ON t1 (a) INVISIBLE;

but both fail with ParseException: Encountered unexpected token: "INVISIBLE". #2076 reported the same problem for ALTER TABLE and was fixed in #2234, but that fix covered the ALTER productions only — the CREATE statements parse their options through CreateParameter(), which did not accept the two tokens.

Making an index invisible is the usual first step before dropping it, so table definitions carrying a bare INVISIBLE are common; today the only spelling that gets through the parser is the conditional comment /*!80000 INVISIBLE */, which is skipped as a comment.

Fix

Adds K_VISIBLE and K_INVISIBLE to the CreateParameter() alternation, following the same approach as the other MySQL index/column attributes there. The attributes are collected into the index spec / column specs like any other option and round-trip through the deparser. Both tokens already exist and stay supported in the ALTER productions from #2234, which use separate paths (IndexOption(), AlterExpressionColumnSetVisibility()).

Tests

  • testCreateTableIndexVisibility — KEY ... INVISIBLE and UNIQUE KEY ... VISIBLE, asserting the index spec
  • testCreateTableColumnVisibility — column-level VISIBLE/INVISIBLE, asserting the column specs
  • testCreateTableIndexVisibilityWithOtherIndexOptions — visibility combined with COMMENT and USING BTREE in either order
  • testCreateTableQuotedColumnNamedVisible — backtick-quoted columns named visible/invisible still parse as identifiers
  • testCreateIndexVisibility — CREATE INDEX ... VISIBLE/INVISIBLE

Full test suite passes (4653 tests, 0 failures). JavaCC parser generation reports the same pre-existing warnings as master with no new choice conflicts.

Sorry, something went wrong.

Uh oh!

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

All reactions
@aparajon @claude
fix: accept VISIBLE/INVISIBLE index and column attributes in CREATE T…
4123f60
…ABLE and CREATE INDEX

MySQL 8.0 invisible indexes (KEY idx (col) INVISIBLE) and invisible columns
failed to parse inside CREATE TABLE, and CREATE INDEX ... INVISIBLE failed
too, because CreateParameter() did not accept the K_VISIBLE/K_INVISIBLE
tokens. The ALTER TABLE productions already support them (JSQLParser#2076 was fixed
for ALTER TABLE only, via JSQLParser#2234); this covers the CREATE statements, which
share CreateParameter(). Tests cover index and column visibility, mixing
visibility with other index options in either order, and quoted columns
named visible/invisible.

Co-Authored-By: Claude Fable 5 <[email protected]>
@aparajon aparajon changed the title Accept VISIBLE/INVISIBLE index and column attributes in CREATE TABLE and CREATE INDEX fix: accept VISIBLE/INVISIBLE index and column attributes in CREATE TABLE and CREATE INDEX Aug 5, 2026
@aparajon aparajon mentioned this pull request Aug 5, 2026
Tolerate MySQL index/column visibility attributes in declarative schema validation cashapp/misk#3878
Merged
@manticore-projects
manticore-projects merged commit aa542c0 into JSQLParser:master Aug 7, 2026
7 checks passed

Uh oh!

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

@manticore-projects

manticore-projects commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

Thank you much, good job!

aparajon reacted with heart emoji
All reactions
  • ❤️ 1 reaction

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

@aparajon @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 01402520 — 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.