How do I provide access to certain rows that are common for all users when implementing PostgreSQL Row Level Security?
0
votes
1
answer
236
views
We have a multi-tenant database and this is a table in which we have implemented row-level security based on tenant_id:
| tenant_id| product_id |
| ----- | -------------- |
| 0 | A |
| 0 | B |
| 1 | 1A|
| 1 | 1B|
| 2 | 2A|
| 2 | 2B |
Our requirement is that the products associated with tenant_id = 0 should be available to all tenants.
Products associated with tenant_id != 0 should only be available to the relevant tenants.
Is there a way to implement this using security definers?
Or do we need to have separate tables?
Asked by user5706
(3 rep)
Jul 28, 2022, 04:36 AM
Last activity: Jul 28, 2022, 09:29 AM
Last activity: Jul 28, 2022, 09:29 AM