pg_dump & RLS - Mailing list pgsql-general

From Eduard Català
Subject pg_dump & RLS
Date
Msg-id CAL54xNZO-9hv+mYJ-0vPzmf_yuj99LfHLiffwOec+KnXj33kfg@mail.gmail.com
Whole thread Raw
Responses Re: pg_dump & RLS  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-general
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!

pgsql-general by date:

Previous
From: Achilleas Mantzios
Date:
Subject: Re: pgbouncer bug?
Next
From: Tom Lane
Date:
Subject: Re: pg_dump & RLS