[Bug] Regression in 0.22.1, createMissingTablesAndColumns fails
See original GitHub issueThe code below works with exposed 0.21.1, but fails with 0.22.1.
package org.user5145.champion.integration
import com.zaxxer.hikari.HikariConfig
import com.zaxxer.hikari.HikariDataSource
import org.jetbrains.exposed.dao.id.IdTable
import org.jetbrains.exposed.sql.*
import org.jetbrains.exposed.sql.transactions.transaction
import kotlin.test.Test
class BugTest {
fun getDefaultDb(): Database {
val config = HikariConfig()
config.jdbcUrl = "jdbc:h2:mem:test;MODE=Postgresql;DB_CLOSE_DELAY=-1;DATABASE_TO_LOWER=TRUE"
config.username = ""
config.password = ""
config.driverClassName = "org.h2.Driver"
return Database.connect(HikariDataSource(config))
}
object Champions : IdTable<String>() {
override val id get() = username
val username = varchar("name", 50).entityId()
val pass = text("pass")
}
object ChampionsStats : IdTable<String>("champions_stats") {
override val id get() = username
val username = varchar("name", 50).entityId() references Champions.username
val hp = text("hp")
}
@Test
fun testCreate() {
transaction(getDefaultDb()) {
SchemaUtils.createMissingTablesAndColumns(Champions, ChampionsStats)
}
}
}
Stacktrace head:
Collection contains no element matching the predicate.
java.util.NoSuchElementException: Collection contains no element matching the predicate.
at org.jetbrains.exposed.sql.statements.jdbc.JdbcDatabaseMetadataImpl$tableConstraints$$inlined$associateWith$lambda$1.invoke(JdbcDatabaseMetadataImpl.kt:170)
at org.jetbrains.exposed.sql.statements.jdbc.JdbcDatabaseMetadataImpl$tableConstraints$$inlined$associateWith$lambda$1.invoke(JdbcDatabaseMetadataImpl.kt:13)
at org.jetbrains.exposed.sql.statements.jdbc.JdbcDatabaseMetadataImplKt.iterate(JdbcDatabaseMetadataImpl.kt:164)
at org.jetbrains.exposed.sql.statements.jdbc.JdbcDatabaseMetadataImpl.tableConstraints(JdbcDatabaseMetadataImpl.kt:123)
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:7 (3 by maintainers)
Top Results From Across the Web
Blue-teaming for Exiv2: three rules of bug fixing for better OSS ...
When you fix a bug, you should add a regression test, which is designed to fail if the same bug is ever reintroduced....
Read more >Why Understanding Regression Defects Is Crucial - HeadSpin
This quick guide highlights the importance of understanding regression defects and the best practices for preventing regression defects.
Read more >Five Common Problems With your Regression Testing Strategy
Regression Testing is Not “Sexy”. The Problem. There's no way around it – regression testing involves running the same tests over and over...
Read more >Reading 11: Debugging - MIT
Reproduce the Bug. Start by finding a small, repeatable test case that produces the failure. If the bug was found by regression testing,...
Read more >Bug #81088 :: error in regression test for oci_fetch_object ...
Bug #81088, error in regression test for oci_fetch_object() and oci_fetch_array(). Submitted: 2021-05-28 15:15 UTC, Modified: ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
This issue still happens in 0.24.1 if you do this (using PostgreSQL):
var myExternalReference = optReference("my_external_reference", MyExternalTable, onDelete = ReferenceOption.CASCADE).index()
)SchemaUtils.createMissingTablesAndColumns
SchemaUtils.createMissingTablesAndColumns
againThen the error happens, this doesn’t happen with 0.17.7 (which was the previous Exposed version I was using before I upgraded)
Not sure if this is intentional because sometimes you don’t want to map everything from your database table to Exposed (in my case sometimes I remove features from my app that I didn’t remove from the database schema yet, in 0.17.7 it worked fine… in 0.24.1 it breaks)
@Tapac should a new issue be created about this issue, or does it fit in here too? The stacktrace is the same as the one in this issue.
Works fine in 0.23.1 for me, but I will keep the issue for @baptistecassar
@Tapac changing
doesn’t do much. If you still want a sample, here
@baptistecassar I’ve been getting this error in 0.23.1 while using postgres, but it was caused by gradle cache and “Reimport all gradle projects” button helped.
Thanks for your help @Tapac 😃