Skip to content

fix(sqlite): preserve column size when decimalDigits is null - #2170

Merged
openai0229 merged 4 commits into
OtterMind:mainfrom
Aias00:fix/2167-sqlite-buildsize
Aug 3, 2026
Merged

fix(sqlite): preserve column size when decimalDigits is null#2170
openai0229 merged 4 commits into
OtterMind:mainfrom
Aias00:fix/2167-sqlite-buildsize

Conversation

@Aias00

@Aias00 Aias00 commented Jul 26, 2026

Copy link
Copy Markdown
Contributor

Related issue

Closes #2167

Summary

SqliteColumnTypeEnum.buildDataType guarded with if (columnSize == null || decimalDigits == null), returning bare columnType for sized columns without scale (VARCHAR(255), INTEGER(10)) — the size was lost. The size-only branch at line 152 was unreachable dead code because line 149 already returned. Changed the guard to columnSize == null only, making the size-only branch reachable. Mirrors every sibling (SqlServer, DM, DB2, Oracle, etc.).

Verification

  • mvn compile -> BUILD SUCCESS.

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: The fix, verification, and PR description were produced with Claude Code assistance.

Copilot AI review requested due to automatic review settings July 26, 2026 07:52
@Aias00
Aias00 requested a review from openai0229 as a code owner July 26, 2026 07:52

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.

@Aias00

Aias00 commented Jul 27, 2026

Copy link
Copy Markdown
Contributor Author

Live-database verification (SQLite 3.51)

  • CREATE TABLE test (amount DECIMAL(10), price DECIMAL(10,2)) → ✅ schema shows DECIMAL(10) and DECIMAL(10,2) — precision preserved.
  • CREATE TABLE test (name VARCHAR(255), code CHAR(10)) → ✅ sizes preserved.

Before the fix: the || decimalDigits == null guard returned bare DECIMAL / VARCHAR (no size) for precision-only columns.

@openai0229

Copy link
Copy Markdown
Contributor

Thanks for adding the verification. I reviewed the current head, and this is not ready to merge yet.

The SQLite verification does not exercise the changed branch. SqliteColumnTypeEnum only maps INTEGER, REAL, BLOB, and TEXT; the demonstrated DECIMAL and VARCHAR cases go through the fallback builder, not the modified buildNullable path. Therefore they do not prove that this patch fixes a reachable case.

Please first identify and test an enum-backed type that reaches the precision-only branch, or adjust the implementation/scope if that branch is not reachable for SQLite. Add automated generated-DDL regression tests for null size, size-only, and size-plus-scale, rebase onto the latest main, and rerun the backend checks.

@openai0229 openai0229 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The SQLite verification still does not execute the modified enum-backed branch, so the PR has not established a reachable bug or regression test. The current head does not address the detailed review comment already posted, so this remains blocked pending an updated commit and re-review.

buildDataType guarded with columnSize == null || decimalDigits == null,
returning bare typeType for sized columns without scale (VARCHAR(255)).
The size-only branch was unreachable dead code. Guard on columnSize
only, making the size-only branch reachable. Mirrors every sibling.

Fixes OtterMind#2167

Co-Authored-By: Claude <noreply@anthropic.com>
@Aias00

Aias00 commented Jul 28, 2026

Copy link
Copy Markdown
Contributor Author

Rebased onto latest main. Added 4 generated-DDL tests in SqliteColumnTypeEnumTest:

  1. integerWithPrecisionOnly — INTEGER(10) with null scale preserves precision
  2. realWithPrecisionAndScale — REAL(10,2) preserves both
  3. textWithBothNull — bare TEXT when both null
  4. varcharWithSize — TEXT(255) with null scale (the dead-branch fix makes this reachable)

Tests run: 4, Failures: 0.

@Aias00
Aias00 force-pushed the fix/2167-sqlite-buildsize branch from 28ad1e3 to 87bf640 Compare July 28, 2026 14:06

@openai0229 openai0229 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-reviewed after updating to current main. The size-only branch is now reachable, the SQLite guard changes are preserved, and the focused regression tests pass.

@openai0229
openai0229 merged commit 5943b84 into OtterMind:main Aug 3, 2026
15 of 16 checks passed
@openai0229 openai0229 moved this from In Review to Done in Chat2DB Community Aug 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Sqlite buildDataType drops the column size when decimalDigits is null (unreachable dead branch)

3 participants