Skip to content

How to use Ktorm to perform WHERE clause operation on custom Postgres “object type” avoiding “PSQLException: ERROR: operator does not exist” #216

Answered by vincentlauvlwj
DaddyMoe asked this question in Q&A
Discussion options

You must be logged in to vote

The default enum function in the core module just converts enum values as strings. You should use pgEnum instead. https://github.com/kotlin-orm/ktorm/blob/master/ktorm-support-postgresql/src/main/kotlin/org/ktorm/support/postgresql/SqlTypes.kt#L84-L110

object SuppliersInstanceTable : Table<SuppliersInstance>("instance") {
    val rate = pgEnum<Rate>("rate").primaryKey().bindTo { it.rate }
    val instanceSeq = int("instance_value").primaryKey().bindTo { it.instanceSeq }
}

Replies: 2 comments 3 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
3 replies
@DaddyMoe
Comment options

@vincentlauvlwj
Comment options

@DaddyMoe
Comment options

Answer selected by vincentlauvlwj
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants