Repository navigation
Report database product name as exactly SQLite so dialect detection works #261
Description
Goal
Return exactly SQLite from DatabaseMetaData.getDatabaseProductName(), keeping the libSQL identity in getDriverName() (libSQL JDBC Driver) and getDatabaseProductVersion().
Exact-match consumers currently fail to recognise the database as SQLite. Liquibase is the clear case: it selects its SQLite dialect only when "SQLite".equalsIgnoreCase(getDatabaseProductName()).
Current behavior
libsql-jdbc/src/main/java/io/github/magnusp/libsql/jdbc/LibsqlDatabaseMetaData.java:207 returns SQLite (libSQL).
- Liquibase 5.0.3
SQLiteDatabase.isCorrectDatabaseImplementationusesPRODUCT_NAME.equalsIgnoreCase(...), soDatabaseFactory.findCorrectDatabaseImplementationreturnsUnsupportedDatabase. The firstupdatethen emitsCREATE TABLE ... (id INT GENERATED BY DEFAULT AS IDENTITY ...), which sqld rejects with a syntax error. Pinned byLiquibaseIT#databaseFactoryFallsBackToUnsupportedDatabasein test(jdbc): add Liquibase integration smoke tests #257, together with the explicitSQLiteDatabaseworkaround inLiquibaseIT#liquibase. - jOOQ maps the product name to
SQLDialect;JDBCUtils.dialect(connection)resolves toSQLDialect.DEFAULTinstead ofSQLITE. - Flyway is unaffected because its SQLite plugin uses
startsWith("SQLite").
Why this is safe
- xerial/sqlite-jdbc returns
SQLite. Matching it is the interoperability contract, andgetDriverName()already carries the libSQL identity. LibsqlConformanceGuardalso checkssqlite_source_id()ends inalt1, so it can rely on the driver name plus that suffix to reject xerial and a non-libSQL server.
Where
Main:
libsql-jdbc/src/main/java/io/github/magnusp/libsql/jdbc/LibsqlDatabaseMetaData.java:207
Tests and fixtures that assert the old string:
libsql-itests/src/test/java/io/github/magnusp/libsql/itest/WebSocketTransportIT.java:110(exact equality)libsql-itests/src/test/java/io/github/magnusp/libsql/itest/LibsqlJdbcIT.java:116(contains("libSQL"))libsql-conformance/src/test/java/io/github/magnusp/libsql/conformance/LibsqlConformanceGuard.java:13(EXPECTED_DATABASE_PRODUCT_NAME)libsql-conformance/src/test/java/io/github/magnusp/libsql/conformance/LibsqlConformanceGuardTest.java(twoSQLite (libSQL)fixtures)
Liquibase tests from #257:
- Delete
LiquibaseIT#databaseFactoryFallsBackToUnsupportedDatabase. - Change the
LiquibaseIT#liquibasehelper to useDatabaseFactory.getInstance().findCorrectDatabaseImplementation(new JdbcConnection(conn)). - Keep
LiquibaseIT#databaseFactoryCannotResolveALibsqlUrlToADriver; it is independent of the product name.
The jOOQ dialect pin added on feat/jooq-itests should be updated in the same wave.
Fix
Return exactly SQLite. Update the guard to keep checking the driver name and the sqlite_source_id() suffix, update the four assertions above, then unpin the Liquibase gap as described.
Verification
./mvnw -pl libsql-jdbc -am verify -Dit.test=LiquibaseIT: the Liquibase tests pass through the normalDatabaseFactorypath, without the explicitSQLiteDatabase../mvnw -pl libsql-conformance -am verify./mvnw -pl libsql-itests -am verify(with the sharedDOCKER_CONFIGdescribed inAGENTS.md)./mvnw spotless:check
Found while adding the Liquibase integration tests in #257.
Activity
test(jdbc): add Liquibase integration smoke tests (#257)
fix(jdbc): report SQLite metadata and the JDBC URL (#268)
docs: document the Liquibase bootstrap for libSQL (#269)