-
-
Notifications
You must be signed in to change notification settings - Fork 155
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
In Ktorm 3.3,
I have a postgresql database with a table that has a column named 'template' that has a datatype of json.
import org.ktorm.jackson.json
import org.ktorm.schema.Table
object TestTable: Table<TestTable>("test_table") {
val id = varchar("id").primaryKey().bindTo { it.id }
val template = json<Template>("template").bindTo { it.template }
}
interface TestTable: Entity<TestTable> {
companion object: Entity.Factory<TestTable>()
var id: String
var template: Template?
}
I am able to successfully pull the model including the json field using the below query
fun findById(id: String): TestTable? { return database.sequenceOf(TestTable) .find { it.id eq id } }
However when I try to patch the table using the below query I get the following error
fun insertOrUpdateById(id: String, testTable: TestTable): Int {
return database.insertOrUpdate(TestTable) {
set(it.template, testTable.template)
onConflict {
set(it.template, testTable.template)
}
}
}
Ktorm; bad SQL grammar []; nested exception is org.postgresql.util.PSQLException: ERROR: column \"template\" is of type json but expression is of type character varying\n Hint: You will need to rewrite or cast the expression.\n Position: 59
Do I need to do something specific in order to update the json value?
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working