Repository navigation
fix(jdbc): return java.sql-shaped DatabaseMetaData results (#156) - #162
Merged
Merged
Conversation
Fixes #156 Hrana 3 is the source of truth for transport, values, metadata, batching, transactions, and error reporting. `java.sql` is the source of truth for the JDBC surface. xerial/sqlite-jdbc 3.53.4.0 is the behavioral reference and conformance foundation, never a copy target. ## What changed - `getProcedures`, `getProcedureColumns`, `getColumnPrivileges`, `getTablePrivileges`, `getBestRowIdentifier`, `getVersionColumns`, and `getUDTs` return an empty result set with the `java.sql` column list through the existing synthesized-metadata path, instead of throwing `SQLFeatureNotSupportedException`. - `getColumns` synthesizes the `sqlite_schema` system table and orders rows the way `getTables` does: temporary, system, table, then view, by name. - `getCrossReference` returns no row when a non-empty catalog or schema is requested, because the server reports neither. - `getPrimaryKeys` sorts rows by `COLUMN_NAME`, matching xerial's `order by cn`, while `KEY_SEQ` keeps the declared key position. - `NAMED_PRIMARY_KEY` also matches a constraint name glued to the keywords, as in ``CONSTRAINT`NamedPk`PRIMARY KEY(...)``. ## Red New unit cases at base `3de2ad5` with only the test diff applied: ``` ./mvnw -pl libsql-jdbc -Dtest=LibsqlDatabaseMetaDataTest test Tests run: 53, Failures: 3, Errors: 14 ``` Vendored `DBMetaDataTest` at the same base, with a temporary copy selected: ``` ./mvnw -pl libsql-conformance -am -Dit.test=DBMetaDataTest verify Tests run: 56, Failures: 3, Errors: 8, Skipped: 1 getColumns, getCrossReferenceCatalogSchemaWithQuote, columnOrderOfgetPrimaryKeys, columnOrderOfgetProcedures, columnOrderOfgetProcedurColumns, columnOrderOfgetColumnPrivileges, columnOrderOfgetTablePrivileges, columnOrderOfgetBestRowIdentifier, columnOrderOfgetVersionColumns, columnOrderOfgetUDTs, columnOrderOfgetTables ``` ## Green At head, with the same temporary copy: ``` ./mvnw -pl libsql-conformance -am -Dit.test=DBMetaDataTest verify Tests run: 56, Failures: 0, Errors: 1, Skipped: 1 ``` The single remaining error is `columnOrderOfgetTables` at line 1113: sqld rejects `CREATE TEMP TABLE` with `SQL_PARSE_ERROR`. The xerial control run passes all 56 on the same copy, so this is remote-model divergence, not a driver gap. The driver does not fake TEMP support; the later selection PR records the divergence or excludes the case. `version` is skipped by its compile-option assumption. Full lanes: ``` ./mvnw -pl libsql-jdbc test Tests run: 336, Failures: 0, Errors: 0 ./mvnw -pl libsql-conformance -am verify Tests run: 123, Failures: 0, Errors: 0, Skipped: 1 ./mvnw -pl libsql-conformance -am -Pxerial-control verify Tests run: 100, Failures: 0, Errors: 0, Skipped: 1 ./mvnw test BUILD SUCCESS ./mvnw spotless:check BUILD SUCCESS ./mvnw -pl libsql-jdbc -am package -DskipTests BUILD SUCCESS tools/export-upstream --verify verified ``` Perf, three interleaved runs of `./mvnw -pl libsql-jdbc test`: base median 2.47 s, head median 2.50 s (+1.2%). Logs are in `/tmp/xerial-parity-i156/`. The vendored tree is unchanged. ## Files `libsql-jdbc/src/main/java/com/github/magnusp/libsql/jdbc/LibsqlDatabaseMetaData.java`, `libsql-jdbc/src/test/java/com/github/magnusp/libsql/jdbc/LibsqlDatabaseMetaDataTest.java`.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
fix(jdbc): return java.sql-shaped DatabaseMetaData results (#156)
Fixes #156
Hrana 3 is the source of truth for transport, values, metadata, batching,
transactions, and error reporting.
java.sqlis the source of truth for theJDBC surface. xerial/sqlite-jdbc 3.53.4.0 is the behavioral reference and
conformance foundation, never a copy target.
What changed
getProcedures,getProcedureColumns,getColumnPrivileges,getTablePrivileges,getBestRowIdentifier,getVersionColumns, andgetUDTsreturn an empty result set with thejava.sqlcolumn list throughthe existing synthesized-metadata path, instead of throwing
SQLFeatureNotSupportedException.getColumnssynthesizes thesqlite_schemasystem table and orders rows theway
getTablesdoes: temporary, system, table, then view, by name.getCrossReferencereturns no row when a non-empty catalog or schema isrequested, because the server reports neither.
getPrimaryKeyssorts rows byCOLUMN_NAME, matching xerial'sorder by cn,while
KEY_SEQkeeps the declared key position.NAMED_PRIMARY_KEYalso matches a constraint name glued to the keywords,as in
CONSTRAINT`NamedPk`PRIMARY KEY(...).Red
New unit cases at base
3de2ad5with only the test diff applied:Vendored
DBMetaDataTestat the same base, with a temporary copy selected:Green
At head, with the same temporary copy:
The single remaining error is
columnOrderOfgetTablesat line 1113:sqld rejects
CREATE TEMP TABLEwithSQL_PARSE_ERROR. The xerial control runpasses all 56 on the same copy, so this is remote-model divergence, not a driver
gap. The driver does not fake TEMP support; the later selection PR records the
divergence or excludes the case.
versionis skipped by its compile-optionassumption.
Full lanes:
Perf, three interleaved runs of
./mvnw -pl libsql-jdbc test: base median2.47 s, head median 2.50 s (+1.2%).
Logs are in
/tmp/xerial-parity-i156/. The vendored tree is unchanged.Files
libsql-jdbc/src/main/java/com/github/magnusp/libsql/jdbc/LibsqlDatabaseMetaData.java,libsql-jdbc/src/test/java/com/github/magnusp/libsql/jdbc/LibsqlDatabaseMetaDataTest.java.