|
|
|
|
|
by andrewstuart
659 days ago
|
|
If you’re interested in row level access control on Postgres, it works like this: Prior to doing queries, you do a SQL query that sets a “Postgres environment
variable”. In very simplified terms, after that, queries automatically have a WHERE clause applied which ensures only rows with the value of the env variable are returned. This is a good thing because it means you do not have to write WHERE customer = ‘blah’ anywhere. |
|
[0] https://www.postgresql.org/docs/current/ddl-rowsecurity.html
EDIT: That page doesn't cover session vars, but this one does:https://www.crunchydata.com/blog/row-level-security-for-tena...