Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(jdbc): existingIndices() misses indexes from tables with a schema #2033

Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -221,8 +221,9 @@ class JdbcDatabaseMetadataImpl(database: String, val metadata: DatabaseMetaData)
rs.close()
names
}
val storedIndexTable = if (tableSchema == currentSchema!!) table.nameInDatabaseCase() else table.nameInDatabaseCaseUnquoted()
val rs = metadata.getIndexInfo(catalog, tableSchema, storedIndexTable, false, false)

val tableNameWithoutSchemaPrefix = table.nameInDatabaseCaseUnquoted()
val rs = metadata.getIndexInfo(catalog, tableSchema, tableNameWithoutSchemaPrefix, false, false)
jackgisel-RL marked this conversation as resolved.
Show resolved Hide resolved

val tmpIndices = hashMapOf<Triple<String, Boolean, Op.TRUE?>, MutableList<String>>()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -698,10 +698,18 @@ class CreateMissingTablesAndColumnsTests : DatabaseTestsBase() {

// SQLite does not recognize creation of schema other than the attached database
withDb(excludeSettings = listOf(TestDB.SQLITE)) { testDb ->
// Should not require to be in the same schema
SchemaUtils.createSchema(schema)
SchemaUtils.create(parentTable, childTable)
jackgisel-RL marked this conversation as resolved.
Show resolved Hide resolved

try {
// Try in different schema
SchemaUtils.createMissingTablesAndColumns(parentTable, childTable)
assertTrue(parentTable.exists())
assertTrue(childTable.exists())

// Try in the same schema
SchemaUtils.setSchema(schema)
SchemaUtils.createMissingTablesAndColumns(parentTable, childTable)
assertTrue(parentTable.exists())
assertTrue(childTable.exists())
jackgisel-RL marked this conversation as resolved.
Show resolved Hide resolved
Expand Down