You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
object AccessTable : IntIdTable() {
val user = integer("user").nullable()
val group = integer("group").nullable()
init {
check { user.isNotNull() neq group.isNotNull() }
}
}
funmain() {
Database.connect("jdbc:h2:mem:regular")
transaction {
SchemaUtils.create(AccessTable)
AccessTable.insert {
it[user] =23
it[group] =null
}
}
}
It can be seen from the log output that the following statement was used to create the table.
CREATETABLEIF NOT EXISTS ACCESS (ID INT AUTO_INCREMENT PRIMARY KEY, "USER"INTNULL, "GROUP"INTNULL, CONSTRAINT check_Access_0 CHECK ("USER"IS NOT NULL<>"GROUP"IS NOT NULL))
On insert the folowing exception was thrown.
Exception in thread "main" org.jetbrains.exposed.exceptions.ExposedSQLException: org.h2.jdbc.JdbcSQLIntegrityConstraintViolationException: Нарушение ограничения: "CHECK_ACCESS_0: (((USER IS NOT NULL) <> ""GROUP"") IS NOT NULL)"
Check constraint violation: "CHECK_ACCESS_0: (((USER IS NOT NULL) <> ""GROUP"") IS NOT NULL)"; SQL statement:
INSERT INTO ACCESS ("GROUP", "USER") VALUES (?, ?) [23513-200]
SQL: [INSERT INTO Access ("GROUP", "USER") VALUES (?, ?)]
It seems that the order of the operands was not checked when creating the table.
The text was updated successfully, but these errors were encountered:
The small example below causes an error
It can be seen from the log output that the following statement was used to create the table.
On insert the folowing exception was thrown.
It seems that the order of the operands was not checked when creating the table.
The text was updated successfully, but these errors were encountered: