ERROR: Cannot run UPDATE or DELETE on table resource_uris because it does not have a PRIMARY KEY in RH-SSO 7.3
Issue
We observe the following ERROR in the server logs when tried to delete one of the realms (though the ERROR is not consistently reproduced all the time)
2019-03-22 11:26:42.772 WARN [org.hibernate.engine.jdbc.spi.SqlExceptionHelper] (default task-28) SQL Error: 0, SQLState: 55000
2019-03-22 11:26:42.773 ERROR [org.hibernate.engine.jdbc.spi.SqlExceptionHelper] (default task-28) ERROR: Cannot run UPDATE or DELETE on table resource_uris because it does not have a PRIMARY KEY.
Hint: Add a PRIMARY KEY to the table
2019-03-22 11:26:42.773 INFO [org.hibernate.engine.jdbc.batch.internal.AbstractBatchImpl] (default task-28) HHH000010: On release of batch it still contained JDBC statements
2019-03-22 11:26:42.773 ERROR [org.keycloak.services.error.KeycloakErrorHandler] (default task-28) Uncaught server error: java.lang.RuntimeException: Error synchronizing authorization data.
at org.keycloak.authorization.store.AuthorizationStoreFactory.lambda$registerSynchronizationListeners$1(AuthorizationStoreFactory.java:62)
at org.keycloak.services.DefaultKeycloakSessionFactory.publish(DefaultKeycloakSessionFactory.java:69) [keycloak-services-4.8.3.Final-redhat-00001.jar:4.8.3.Final-redhat-00001]
at org.keycloak.models.jpa.JpaRealmProvider.removeClient(JpaRealmProvider.java:572)
at org.keycloak.models.jpa.JpaRealmProvider.removeRealm(JpaRealmProvider.java:153)
at org.keycloak.models.cache.infinispan.RealmCacheSession.removeRealm(RealmCacheSession.java:486)
at org.keycloak.services.managers.RealmManager.removeRealm(RealmManager.java:248) [keycloak-services-4.8.3.Final-redhat-00001.jar:4.8.3.Final-redhat-00001]
at org.keycloak.services.resources.admin.RealmAdminResource.deleteRealm(RealmAdminResource.java:453) [keycloak-services-4.8.3.Final-redhat-00001.jar:4.8.3.Final-redhat-00001]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.8.0_162]
...
...
Caused by: org.keycloak.models.ModelException: javax.persistence.PersistenceException: org.hibernate.exception.GenericJDBCException: could not execute statement
at org.keycloak.connections.jpa.PersistenceExceptionConverter.convert(PersistenceExceptionConverter.java:61)
at org.keycloak.connections.jpa.PersistenceExceptionConverter.invoke(PersistenceExceptionConverter.java:51)
at com.sun.proxy.$Proxy92.flush(Unknown Source)
...
... 77 more
Caused by: javax.persistence.PersistenceException: org.hibernate.exception.GenericJDBCException: could not execute statement
at org.hibernate.internal.ExceptionConverterImpl.convert(ExceptionConverterImpl.java:154)
at org.hibernate.internal.ExceptionConverterImpl.convert(ExceptionConverterImpl.java:181)
...
... 86 more
Caused by: org.hibernate.exception.GenericJDBCException: could not execute statement
at org.hibernate.exception.internal.StandardSQLExceptionConverter.convert(StandardSQLExceptionConverter.java:47)
at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:113)
...
... 91 more
Caused by: org.postgresql.util.PSQLException: ERROR: Cannot run UPDATE or DELETE on table resource_uris because it does not have a PRIMARY KEY.
Hint: Add a PRIMARY KEY to the table
at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2477)
at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:2190)
at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:300)
at org.postgresql.jdbc.PgStatement.executeInternal(PgStatement.java:428)
at org.postgresql.jdbc.PgStatement.execute(PgStatement.java:354)
at org.postgresql.jdbc.PgPreparedStatement.executeWithFlags(PgPreparedStatement.java:169)
at org.postgresql.jdbc.PgPreparedStatement.executeUpdate(PgPreparedStatement.java:136)
at org.jboss.jca.adapters.jdbc.WrappedPreparedStatement.executeUpdate(WrappedPreparedStatement.java:537)
at org.hibernate.engine.jdbc.internal.ResultSetReturnImpl.executeUpdate(ResultSetReturnImpl.java:175)
... 99 more
Environment
- Red Hat Single Sign-On (RH-SSO)
- 7.3.0
Subscriber exclusive content
A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.