| From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
|---|---|
| To: | Eduard Català <eduard(dot)catala(at)gmail(dot)com> |
| Cc: | pgsql-general(at)lists(dot)postgresql(dot)org |
| Subject: | Re: pg_dump & RLS |
| Date: | 2020-08-21 19:08:19 |
| Message-ID: | 2011519.1598036899@sss.pgh.pa.us |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-general |
=?UTF-8?Q?Eduard_Catal=C3=A0?= <eduard(dot)catala(at)gmail(dot)com> writes:
> - ¿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*);
That isn't the world's greatest design, but you should be
able to do something like
export PGOPTIONS="-c custom.company_id=42"
pg_dump ...
I kind of wonder why bother with RLS if any user can bypass it
just by changing a GUC, though. It'd be better for the policy
to check something like role membership.
regards, tom lane
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Michael Paquier | 2020-08-22 01:47:36 | Re: When are largobject records TOASTed into pg_toast_2613? |
| Previous Message | Eduard Català | 2020-08-21 19:02:47 | pg_dump & RLS |