django-dbbackup icon indicating copy to clipboard operation
django-dbbackup copied to clipboard

`pg_dump` error: Query would be affected by row-level security policy

Open 12diego34 opened this issue 2 years ago • 1 comments

Bug Report

pg_dump: error: query failed: ERROR: query would be affected by row-level security policy for table

Describe the bug

Within a postgresql database, hosted in aws, I have a series of tables that have the row-level policy activated.

When I want to run the backup on S3, I get the error:

pg_dump: error: query failed: ERROR: query would be affected by row-level security policy.
HINT: To disable the policy for the table's owner, use ALTER TABLE NO FORCE ROW LEVEL SECURITY

To Reproduce

In order to reproduce the error, you can have a table with the row-level policy activated and try to make a backup. I don't know if it matters if the destination is an S3 bucket.

Expected behavior

Being able to make a backup of the database, regardless of whether there are tables that have or do not have the policy activated at the row level.

Versions

Django-dbbackup

  • pypi: 4.0.2

External tools

  • Python: 3.8.10
  • Django: 3.2.4
  • OS: Ubuntu 20.04.6 LTS

12diego34 avatar Nov 20 '23 01:11 12diego34

@12diego34 When this issue occurred, did you configure dbbackup to use an admin account, or a user account?

Postgres superusers are exempt from row security policy. If the issue occurs with an admin account, then perhaps you're using a cloud-hosted instance of postgres? Every cloud platform gives different restrictions to superusers, so I'd need to know some more details on your provider.

Archmonger avatar Aug 23 '25 06:08 Archmonger