0
PostgreSQL
12.6

Flyway Maven Dependency
org.flywaydb
flyway-core
6.5.7

I'm using maven to kick off a flyway:clean run, specified to a remote database. I have DDL permissions, however flyway is giving the following message

ERROR: must be owner of view pg_stat_statements_allusers

Unfortunately, I am unable to get ownership over the Database view.

My question is, is there a way to configure flyway to ignore the pg_stat_statements_allusers during my run flyway:clean

enter image description here

Jens
  • 67,715
  • 15
  • 98
  • 113
  • Well, `pg_stat_statements` should not be dropped to begin with. It's part of the extension [pg_stat_statements](https://www.postgresql.org/docs/current/pgstatstatements.html) and typically owned by the superuser. It seems Flyway is trying to drop _everything_ rather than everything that the _user owns_. (for that `drop owned by current user;` is a more efficient and easier approach anyway). –  Aug 12 '22 at 06:38

1 Answers1

0

Thanks to @a_horse_with_no_name which made a good point in regards to the super user. I looked into the superuser privileges which helped me solve the problem. But I was unable to figure out how to "drop owned by current user".

It came down to an internal company policy that requires using the pg_stat_statements specifically in the public schema across all DB's, which was owned only by the superuser. Therefore by using a different schema than the public schema, I was able to avoid the locked pg_stat_statements unlike with the public schema and run flyway clean.