Hi all,
Sorry if this is not the appropriate list, I think so.
- ¿is posible to export using pg_dump only the rows that satisfy a rls check?
- Of course, yes, use the --enable-row-security option in pg_dump
- Yes, but my RLS _expression_ relies on a GUC:
CREATE POLICY my_policy ON my_table USING (company_id = current_setting('company_id')::int);
Prior to starting dumping I need to set the company_id GUC into the session, if not, there's no way to only export some rows.
Any ideas?
- Execute a command before starting the export
- Some kind of login trigger for a special user
- ...
Thank you!