Uploaded image for project: 'Keycloak'
  1. Keycloak
  2. KEYCLOAK-7982

DB Migration to 4.2.0.Final fails with ERROR: relation "public.resource_uri" does not exist

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Major
    • Resolution: Duplicate Issue
    • Affects Version/s: 4.2.0.Final
    • Fix Version/s: 4.2.1.Final
    • Component/s: Database
    • Labels:
    • Environment:

      PostgreSQL, Docker

    • Steps to Reproduce:
      Hide

      Upgrade from 4.1.0 to 4.2.0

      Show
      Upgrade from 4.1.0 to 4.2.0
    • Docs QE Status:
      NEW
    • QE Status:
      NEW

      Description

      When upgrading from 4.1.0.Final to 4.2.0.Final the following error is logged and keycloak is shut down:

      Caused by: liquibase.exception.MigrationFailedException: Migration failed for change set META-INF/jpa-changelog-authz-4.2.0.Final.xml::authz-4.2.0.Final::mhajas@redhat.com:
           Reason: liquibase.exception.DatabaseException: ERROR: relation "public.resource_uri" does not exist
        Position: 13 [Failed SQL: INSERT INTO public.resource_uri (RESOURCE_ID, VALUE) VALUES ('REMOVED', '/*')]
      	at liquibase.changelog.ChangeSet.execute(ChangeSet.java:619)
      	at liquibase.changelog.visitor.UpdateVisitor.visit(UpdateVisitor.java:51)
      	at liquibase.changelog.ChangeLogIterator.run(ChangeLogIterator.java:79)
      	at liquibase.Liquibase.update(Liquibase.java:214)
      	at liquibase.Liquibase.update(Liquibase.java:192)
      	at liquibase.Liquibase.update(Liquibase.java:188)
      	at org.keycloak.connections.jpa.updater.liquibase.LiquibaseJpaUpdaterProvider.updateChangeSet(LiquibaseJpaUpdaterProvider.java:182)
      	at org.keycloak.connections.jpa.updater.liquibase.LiquibaseJpaUpdaterProvider.update(LiquibaseJpaUpdaterProvider.java:102)
      	... 54 more
      

      https://github.com/keycloak/keycloak/blob/master/model/jpa/src/main/resources/META-INF/jpa-changelog-authz-4.2.0.Final.xml creates a table called RESOURCE_URIS (plural) while https://github.com/keycloak/keycloak/blob/master/model/jpa/src/main/java/org/keycloak/connections/jpa/updater/liquibase/custom/AuthzResourceUseMoreURIs.java tries to insert data into RESOURCE_URI (singular).

        Gliffy Diagrams

          Attachments

            Activity

              People

              • Assignee:
                pcraveiro Pedro Igor
                Reporter:
                srt Stefan Reuter
              • Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: