Reputation: 1429
I have the following SQL query using Kotlin Exposed to a Postgres server with a capitalized table name:
object Table: IntIdTable("Table") {
val tC = text("Text")
val vC = text("Value")
}
Database.connect("jdbc:postgresql://...", driver = "org.postgresql.Driver")
transaction {
logger.addLogger(StdOutSqlLogger)
val query = Table.select {
Table.id eq 5
}
query.forEach {
println( it[Table.tC] )
}
}
But I am getting back:
Exception in thread "main" org.postgresql.util.PSQLException: ERROR: relation "table" does not exist
Usually I would simply be able to quote the table name "Table"
to use the capitalized table names, but can't seem to do that with Kotlin Exposed; so is there a way to use the capitalized table name by preventing it from being lowercased?
Upvotes: 2
Views: 1698
Reputation: 103
I was able to resolve this by using escaped quotes within the table string, example for the above question would be as follows:
object Table : IntIdTable("\"Table\"") {
Upvotes: 2
Reputation: 2337
Could you provide the whole sample and point to the place where the exception is thrown? From the current code that's unclear who and how trying to create relation
to the table.
Upvotes: 0