SELECT row_security_active('certain_table') returns False no matter what
0
votes
1
answer
92
views
I am trying to set up row level security in an Amazon RDS database (Postgres 15) to power a Django project.
The user I pass to Django is not superuser and doesn't have
BYPASSRLS
inherited from any of it's roles. I know that from this query:
SELECT
rolname,
rolsuper,
rolbypassrls
FROM
pg_roles
WHERE
oid in (
WITH RECURSIVE cte AS (
SELECT
oid
FROM
pg_roles
WHERE
rolname = current_user
UNION
ALL
SELECT
m.roleid
FROM
cte
JOIN pg_auth_members m ON m.member = cte.oid
)
SELECT
oid
FROM
cte
)
The user does own the database, schema and table, but when I added the policy I also ran:
ALTER TABLE certain_table ENABLE ROW LEVEL SECURITY;
ALTER TABLE certain_table FORCE ROW LEVEL SECURITY;
On a local Postgres (Docker) and the same setup, executing SELECT row_security_active('certain_table')
return True
. On RDS it returns False
.
Am I missing any other criteria for bypassing row level security?
Asked by Lorenzo Peña
(211 rep)
Nov 14, 2023, 11:09 AM
Last activity: Nov 15, 2023, 10:58 AM
Last activity: Nov 15, 2023, 10:58 AM