Skip to content

fix(jdbc): fold transaction modes and table types with Locale.ROOT - #288

Merged
magnusp merged 1 commit into
mainfrom
fix/locale-root-transaction-table-types
Oct 31, 2026
Merged

magnusp merged 1 commit into
mainfrom
fix/locale-root-transaction-table-types

Conversation

@magnusp

@magnusp magnusp commented Oct 31, 2026

Copy link
Copy Markdown
Owner

Description

TransactionMode.from and MetadataSql.tables called toUpperCase() without a locale. Under a Turkish default locale, "immediate" folded to "İMMEDİATE", so TransactionMode.from("immediate") threw IllegalArgumentException, and the VIEW table-type filter folded to "VİEW", so getTables(..., new String[] {"VIEW"}) matched nothing.

Both sites now use Locale.ROOT, matching the policy the rest of the driver adopted in #283.

Call sites

File Line Folding
libsql-jdbc/src/main/java/io/github/magnusp/libsql/jdbc/LibsqlConnection.java 99 transaction mode in TransactionMode.from
libsql-jdbc/src/main/java/io/github/magnusp/libsql/jdbc/MetadataSql.java 36 table type in tables

Tests

  • transactionModeFoldsUnderATurkishDefaultLocale sets Locale.forLanguageTag("tr") and asserts TransactionMode.from("immediate") is IMMEDIATE and from("exclusive") is EXCLUSIVE.
  • tableTypeFilterFoldsUnderATurkishDefaultLocale builds the predicate with {"table", "view"} under the same default and asserts AND TABLE_TYPE IN ('TABLE','VIEW').
  • The existing foreign-key locale pin now uses restrict instead of set null, so it is mutation-sensitive too (set null and cascade contain no Turkish-sensitive letter). The set null mapping stays covered by LibsqlDatabaseMetaDataTest.getImportedKeysMapsForeignKeyRowsAndNames.

Both new tests fail before the fix and pass after it. Before the fix, the transaction-mode test fails with No enum constant ...İMMEDİATE, and the table-type test fails on the VİEW literal. Reverting the ForeignKeyMetadata call site to the default locale makes the strengthened FK pin fail.

No public API, exception type, or message changed. Locale.ROOT and Locale.ENGLISH fold identically for these inputs, as probed in #285.

Type of Change

  • Bug fix (non-breaking change fixing an issue)

Checklist

  • My code follows the code style of this project (./mvnw spotless:check).
  • I have added tests that prove my fix is effective or that my feature works.
  • All unit tests pass (./mvnw -pl libsql-jdbc -am test: 1622 tests, 0 failures). The container lane runs in CI.
  • I have updated documentation where appropriate (none needed).

Fixes #286

TransactionMode.from and MetadataSql.tables called toUpperCase without a
locale. Under a Turkish default locale, "immediate" folded to
"İMMEDİATE" and the VIEW table-type literal to "VİEW", so the mode
lookup threw and the getTables filter matched nothing.

Use Locale.ROOT at both sites, matching the policy of the rest of the
driver. Pin both call sites with Turkish-default tests, and switch the
foreign-key locale pin to "restrict" so it is mutation-sensitive.

Closes #286
@magnusp
magnusp merged commit 3a504ba into main Oct 31, 2026
6 checks passed
@magnusp
magnusp deleted the fix/locale-root-transaction-table-types branch October 31, 2026 18:36
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.

fix(jdbc): fold transaction modes and table types with Locale.ROOT

1 participant