title: Helm Keycloak Postgres ERROR: column "client_id" does not exist
body: <p>I followed this <a href="https://github.com/kubernetes/charts/tree/master/incubator/keycloak" rel="nofollow noreferrer">guide</a> to Config Keycloak + Postgres use Helm. </p>
  
  <p>I have tried with H2 database (default), it works fine. And then, I config to use with Postgres, below is my config.</p>
  
  <pre><code>keycloak:
    replicas: 1
  
    image:
      repository: jboss/keycloak
      tag: 3.4.0.Final
    username: admin
    password: admin
    service:
      type: LoadBalancer
    persistence:
      deployPostgres: false
      dbVendor: POSTGRES
  
      dbName: keycloak
      dbHost: xxx.pgsql.domain.com
      dbPort: 5432
      dbUser: keycloak
  
      # Only used if no existing secret is specified. In this case a new secret is created
      dbPassword: xxxxxxxxxx
  </code></pre>
  
  <p>Seem the connection fine, but the error logs:</p>
  
  <pre><code>7:18:24,071 ERROR [org.keycloak.connections.jpa.updater.liquibase.conn.DefaultLiquibaseConnectionProvider] (ServerService Thread Pool -- 56) Change Set META-INF/jpa-changelog-authz-3.4.0.CR1.xml::authz-3.4.0.CR1-resource-server-pk-change-part2::glavoie@gmail.com failed.  Error: ERROR: column "client_id" does not exist
    Position: 73 [Failed SQL: UPDATE RESOURCE_SERVER_POLICY p SET RESOURCE_SERVER_CLIENT_ID = (SELECT CLIENT_ID FROM RESOURCE_SERVER s WHERE s.ID = p.RESOURCE_SERVER_ID)]: liquibase.exception.DatabaseException: ERROR: column "client_id" does not exist
    Position: 73 [Failed SQL: UPDATE RESOURCE_SERVER_POLICY p SET RESOURCE_SERVER_CLIENT_ID = (SELECT CLIENT_ID FROM RESOURCE_SERVER s WHERE s.ID = p.RESOURCE_SERVER_ID)]
      at liquibase.executor.jvm.JdbcExecutor$ExecuteStatementCallback.doInStatement(JdbcExecutor.java:316)
      at liquibase.executor.jvm.JdbcExecutor.execute(JdbcExecutor.java:55)
      at liquibase.executor.jvm.JdbcExecutor.execute(JdbcExecutor.java:122)
      at liquibase.database.AbstractJdbcDatabase.execute(AbstractJdbcDatabase.java:1247)
      at liquibase.database.AbstractJdbcDatabase.executeStatements(AbstractJdbcDatabase.java:1230)
      at liquibase.changelog.ChangeSet.execute(ChangeSet.java:548)
      at liquibase.changelog.visitor.UpdateVisitor.visit(UpdateVisitor.java:51)
      at liquibase.changelog.ChangeLogIterator.run(ChangeLogIterator.java:73)
      at liquibase.Liquibase.update(Liquibase.java:210)
      at liquibase.Liquibase.update(Liquibase.java:190)
      at liquibase.Liquibase.update(Liquibase.java:186)
      at org.keycloak.connections.jpa.updater.liquibase.LiquibaseJpaUpdaterProvider.updateChangeSet(LiquibaseJpaUpdaterProvider.java:135)
      at org.keycloak.connections.jpa.updater.liquibase.LiquibaseJpaUpdaterProvider.update(LiquibaseJpaUpdaterProvider.java:88)
      at org.keycloak.connections.jpa.updater.liquibase.LiquibaseJpaUpdaterProvider.update(LiquibaseJpaUpdaterProvider.java:67)
      at org.keycloak.connections.jpa.DefaultJpaConnectionProviderFactory.update(DefaultJpaConnectionProviderFactory.java:322)
      at org.keycloak.connections.jpa.DefaultJpaConnectionProviderFactory.migration(DefaultJpaConnectionProviderFactory.java:308)
      at org.keycloak.connections.jpa.DefaultJpaConnectionProviderFactory.lambda$lazyInit$0(DefaultJpaConnectionProviderFactory.java:179)
      at org.keycloak.models.utils.KeycloakModelUtils.suspendJtaTransaction(KeycloakModelUtils.java:544)
      at org.keycloak.connections.jpa.DefaultJpaConnectionProviderFactory.lazyInit(DefaultJpaConnectionProviderFactory.java:130)
      at org.keycloak.connections.jpa.DefaultJpaConnectionProviderFactory.create(DefaultJpaConnectionProviderFactory.java:78)
      at org.keycloak.connections.jpa.DefaultJpaConnectionProviderFactory.create(DefaultJpaConnectionProviderFactory.java:56)
      at org.keycloak.services.DefaultKeycloakSession.getProvider(DefaultKeycloakSession.java:163)
      at org.keycloak.models.jpa.JpaRealmProviderFactory.create(JpaRealmProviderFactory.java:51)
      at org.keycloak.models.jpa.JpaRealmProviderFactory.create(JpaRealmProviderFactory.java:33)
      at org.keycloak.services.DefaultKeycloakSession.getProvider(DefaultKeycloakSession.java:163)
      at org.keycloak.models.cache.infinispan.RealmCacheSession.getDelegate(RealmCacheSession.java:144)
      at org.keycloak.models.cache.infinispan.RealmCacheSession.getMigrationModel(RealmCacheSession.java:137)
      at org.keycloak.migration.MigrationModelManager.migrate(MigrationModelManager.java:74)
      at org.keycloak.services.resources.KeycloakApplication.migrateModel(KeycloakApplication.java:244)
      at org.keycloak.services.resources.KeycloakApplication.migrateAndBootstrap(KeycloakApplication.java:185)
      at org.keycloak.services.resources.KeycloakApplication$1.run(KeycloakApplication.java:144)
      at org.keycloak.models.utils.KeycloakModelUtils.runJobInTransaction(KeycloakModelUtils.java:227)
      at org.keycloak.services.resources.KeycloakApplication.&lt;init&gt;(KeycloakApplication.java:135)
      at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
      at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
      at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
      at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
      at org.jboss.resteasy.core.ConstructorInjectorImpl.construct(ConstructorInjectorImpl.java:150)
      at org.jboss.resteasy.spi.ResteasyProviderFactory.createProviderInstance(ResteasyProviderFactory.java:2298)
      at org.jboss.resteasy.spi.ResteasyDeployment.createApplication(ResteasyDeployment.java:340)
      at org.jboss.resteasy.spi.ResteasyDeployment.start(ResteasyDeployment.java:253)
      at org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.init(ServletContainerDispatcher.java:120)
      at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.init(HttpServletDispatcher.java:36)
      at io.undertow.servlet.core.LifecyleInterceptorInvocation.proceed(LifecyleInterceptorInvocation.java:117)
      at org.wildfly.extension.undertow.security.RunAsLifecycleInterceptor.init(RunAsLifecycleInterceptor.java:78)
      at io.undertow.servlet.core.LifecyleInterceptorInvocation.proceed(LifecyleInterceptorInvocation.java:103)
      at io.undertow.servlet.core.ManagedServlet$DefaultInstanceStrategy.start(ManagedServlet.java:250)
      at io.undertow.servlet.core.ManagedServlet.createServlet(ManagedServlet.java:133)
      at io.undertow.servlet.core.DeploymentManagerImpl$2.call(DeploymentManagerImpl.java:565)
      at io.undertow.servlet.core.DeploymentManagerImpl$2.call(DeploymentManagerImpl.java:536)
      at io.undertow.servlet.core.ServletRequestContextThreadSetupAction$1.call(ServletRequestContextThreadSetupAction.java:42)
      at io.undertow.servlet.core.ContextClassLoaderSetupAction$1.call(ContextClassLoaderSetupAction.java:43)
      at org.wildfly.extension.undertow.security.SecurityContextThreadSetupAction.lambda$create$0(SecurityContextThreadSetupAction.java:105)
      at org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService$UndertowThreadSetupAction.lambda$create$0(UndertowDeploymentInfoService.java:1508)
      at org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService$UndertowThreadSetupAction.lambda$create$0(UndertowDeploymentInfoService.java:1508)
      at org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService$UndertowThreadSetupAction.lambda$create$0(UndertowDeploymentInfoService.java:1508)
      at org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService$UndertowThreadSetupAction.lambda$create$0(UndertowDeploymentInfoService.java:1508)
      at io.undertow.servlet.core.DeploymentManagerImpl.start(DeploymentManagerImpl.java:578)
      at org.wildfly.extension.undertow.deployment.UndertowDeploymentService.startContext(UndertowDeploymentService.java:100)
      at org.wildfly.extension.undertow.deployment.UndertowDeploymentService$1.run(UndertowDeploymentService.java:81)
      at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
      at java.util.concurrent.FutureTask.run(FutureTask.java:266)
      at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
      at java.lang.Thread.run(Thread.java:748)
      at org.jboss.threads.JBossThread.run(JBossThread.java:320)
  Caused by: org.postgresql.util.PSQLException: ERROR: column "client_id" does not exist
    Position: 73
      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.PgStatement.executeWithFlags(PgStatement.java:301)
      at org.postgresql.jdbc.PgStatement.executeCachedSql(PgStatement.java:287)
      at org.postgresql.jdbc.PgStatement.executeWithFlags(PgStatement.java:264)
      at org.postgresql.jdbc.PgStatement.execute(PgStatement.java:260)
      at org.jboss.jca.adapters.jdbc.WrappedStatement.execute(WrappedStatement.java:198)
      at liquibase.executor.jvm.JdbcExecutor$ExecuteStatementCallback.doInStatement(JdbcExecutor.java:314)
      ... 65 more
  
  17:18:24,096 ERROR [org.jboss.msc.service.fail] (ServerService Thread Pool -- 56) MSC000001: Failed to start service jboss.undertow.deployment.default-server.default-host./auth: org.jboss.msc.service.StartException in service jboss.undertow.deployment.default-server.default-host./auth: java.lang.RuntimeException: RESTEASY003325: Failed to construct public org.keycloak.services.resources.KeycloakApplication(javax.servlet.ServletContext,org.jboss.resteasy.core.Dispatcher)
      at org.wild...
  </code></pre>
  
  <p>Please help me to fix it. Many thanks.</p>