Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
PostgreSQL: clean doesn't unlink referenced LOBs in pg_largeobject #1934
Which version and edition of Flyway are you using?
If this is not the latest version, can you reproduce the issue with the latest one as well?
(Many bugs are fixed in newer releases and upgrading will often resolve the issue)
Which client are you using? (Command-line, Java API, Maven plugin, Gradle plugin)
Which database are you using (type & version)?
Which operating system are you using?
What did you do?
(Please include the content causing the issue, any relevant configuration settings, the SQL statement that failed (if relevant) and the command you ran.)
I run the following Java code test preparation:
What did you expect to see?
I expect that schema.clean() does clean the 'app_schema' AND the referenced entries in 'pg_catalog' catalog.
What did you see instead?
I see remaining entries in catalog 'pg_catalog'.'pg_largeobject' which not referenced anymore.
Hmmm I don't see an easy solution to this. Your table will most likely only contain OIDs. We would have to check whether these belong to large objects and if they do, unlink them. But that's not necessarily safe as these LOBs may still be referenced from a different schema that the user doesn't want cleaned.
Until this is resolved, I'll document it as a limitation. You can workaround this by using callbacks and doing the work there.
P.S.: Please report the other issue you face with 5.0.7 as well.
changed the title from
schema.clean() doesn't clean referenced entries in other schema
schema.clean() doesn't clean referenced LOBs in pg_largeobject
Feb 26, 2018
After some research in documentation of postgresql I found the build in utility 'vacuumlo' which removes orphaned large objects. May be it is possible to call this function during clean.
That has a number of issues. First of all we couldn't assume the CLI tool is installed, second it is challenging on RDS: https://dba.stackexchange.com/questions/174663/how-to-vacuumlo-an-rds-postgresql-database#174664