I would like to discard the contents of the pg_largeobject table and reclaim its disk space. When I try issuing this command:
truncate pg_largeobject
I get this response:
ERROR: permission denied: "pg_largeobject" is a system catalog
This is even though I am issuing the command as user postgres (a superuser). There is insufficient disk space to do a VACUUM FULL while the table contains a lot of rows. I've also tried just deleting all the rows in preparation for a VACUUM FULL, but this was still going after a whole day, and ended up being interrupted. I'd prefer to truncate if at all possible.
Is truncation of this table possible? It currently contains around 1 TB of images I no longer want. I've removed references to the table from all my other tables (and deleted all rows from pg_largeobject_metadata).
Turning on allow_system_table_mods was the answer. The truncate then took only a few minutes. Thanks to Nick Barnes for this suggestion and to an old article that confirmed this approach.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With