0

Environment Info:

  • Postgres 14.7 on RDS

I am trying to apply DB changes through liquibase, and to my surprise I am getting following error. The role mentioned in error (xxxxx) does not exist on database. Neither the sequence it is trying to alter.

What I am not able to figure out is where is DB engine getting these info from. Running same plain insert statement on postgres direcly also produces same error. This is fresh instance and this is supposed to be the first record in table.

[ERROR] Failed to execute goal org.liquibase:liquibase-maven-plugin:4.3.5:update (default-cli) on project liquibasedatabase:
[ERROR] Error setting up or running Liquibase:
[ERROR] liquibase.exception.MigrationFailedException: Migration failed for change set src/main/dbschema/changesets/common/master-data/changes.xml::change-id::owner:
[ERROR]      Reason: liquibase.exception.DatabaseException: ERROR: role "xxxxx" does not exist
[ERROR]   Where: SQL statement "ALTER SEQUENCE IF EXISTS NON_EXISTING_SEQ OWNER TO XXXXX"
[ERROR] PL/pgSQL function create_sequence() line 21 at EXECUTE [Failed SQL: (0) INSERT INTO table (id,name,serial_number) VALUES (7,'something','something')]
5
  • @LaurenzAlbe As I’ve mentioned in question - I did run same insert statement on db natively, and got same error there as well. So liquibase is picking the error from DB. Jan 30 at 14:36
  • That may be true @GAURAVRATHOD, but the commands originate from Liquibase, so you'd have to figure out why it references non-existent objects.
    – mustaccio
    Jan 30 at 14:50
  • 1
    Looks like there is a trigger defined. Can you connect with psql, run \d+ table_name, edit the question and add the output? Jan 30 at 14:50
  • Or perhaps it is not a table, but a foreign table or a view. Jan 30 at 14:51
  • Good catch @LaurenzAlbe! It was a trigger creating a sequence if not existed and assigning onwership to that 'non-existant' role. Thank you very much! Jan 30 at 17:11

1 Answer 1

0

That error doesn't look like it is caused by the statement itself. It might well be a statement in a trigger function invoked by the statement.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.