Skip to content

fix(mysql): preserve null auto increment metadata - #2838

Open
HandSonic wants to merge 2 commits into
OtterMind:mainfrom
HandSonic:fix/mysql-null-auto-increment
Open

HandSonic wants to merge 2 commits into
OtterMind:mainfrom
HandSonic:fix/mysql-null-auto-increment

Conversation

@HandSonic

@HandSonic HandSonic commented Aug 30, 2026 •

Copy link
Copy Markdown
Contributor

Related issue

N/A - no matching issue was found.

Summary

MySQL INFORMATION_SCHEMA.TABLES.AUTO_INCREMENT is nullable, but the metadata mapper used ResultSet.getLong without wasNull. SQL NULL therefore became 0, and downstream DDL generation could treat a table without an auto-increment counter as AUTO_INCREMENT=0. This change preserves null while retaining real increment values.

Affected surfaces

  • Frontend / Web
  • Backend / API / Storage
  • Database plugin / Driver
  • JCEF / Desktop packaging
  • CI / Build / Release
  • Documentation only

Verification

  • Commands and results:
    • Red null case returned 0 instead of null; non-null 42 control passed.
    • Focused null/non-null metadata tests: 2 passed.
    • MySQL module tests after rebase: 702 passed.
    • Plugin reactor package: succeeded.
    • Fork code and CodeQL checks: rerunning for the rebased head.
  • Manual verification: N/A - a strict ResultSet proxy models JDBC getLong / immediate wasNull semantics.
  • UI evidence: N/A

Risk and compatibility

  • Public API or stored data: No API or stored data changes.
  • Database or driver compatibility: Corrects nullable MySQL table metadata; non-null values are unchanged.
  • Network, privacy, or security: N/A.
  • Community / Local / Pro boundary: Shared Community MySQL plugin.
  • Backward compatibility: Tables with an actual auto-increment counter retain the same value.

Reviewer map

  • Start here: MysqlMetaData.tables AUTO_INCREMENT mapping and MysqlTableMetadataNullTest.
  • Failure condition: SQL NULL maps to zero or a real increment value is lost.
  • Rollback or disable path: Revert commit 915dc9210d18291b56c907f1e7e7dd36d35ab3db; no migration is required.

Contributor declaration

  • I linked the Issue that defines this change.
  • I tested the affected behavior and reported the actual results above.
  • I did not include credentials, private data, or generated build output.
  • I disclosed substantial AI assistance below, or this PR contains no substantial AI-generated code.

AI assistance: OpenAI Codex assisted with diagnosis, implementation, automated tests, verification, and adversarial review.

@HandSonic
HandSonic force-pushed the fix/mysql-null-auto-increment branch from ac63c18 to 915dc92 Compare September 3, 2026 18:20
Align existing OtterMind/Chat2DB PR OtterMind#2838 while preserving its focused fix.

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

Status: In Review

Development

Successfully merging this pull request may close these issues.

2 participants