Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 51e9df7

Browse files
committed
Improve RLS documentation with respect to COPY
Documentation for pg_restore said COPY TO does not support row security when in fact it should say COPY FROM. Fix that. While at it, make it clear that "COPY FROM" does not allow RLS to be enabled and INSERT should be used instead. Also that SELECT policies will apply to COPY TO statements. Back-patch to 9.5 where RLS first appeared. Author: Joe Conway Reviewed-By: Dean Rasheed and Robert Haas Discussion: https://postgr.es/m/5744FA24.3030008%40joeconway.com
1 parent f0f2e56 commit 51e9df7

File tree

3 files changed

+15
-1
lines changed

3 files changed

+15
-1
lines changed

doc/src/sgml/ref/copy.sgml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -418,6 +418,15 @@ COPY <replaceable class="parameter">count</replaceable>
418418
to have column privileges on the column(s) listed in the command.
419419
</para>
420420

421+
<para>
422+
If row-level security is enabled for the table, the relevant
423+
<command>SELECT</command> policies will apply to <literal>COPY
424+
<replaceable class="parameter">table</> TO</literal> statements.
425+
Currently, <command>COPY FROM</command> is not supported for tables
426+
with row-level security. Use equivalent <command>INSERT</command>
427+
statements instead.
428+
</para>
429+
421430
<para>
422431
Files named in a <command>COPY</command> command are read or written
423432
directly by the server, not by the client application. Therefore,

doc/src/sgml/ref/pg_dump.sgml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -702,6 +702,11 @@ PostgreSQL documentation
702702
to dump the parts of the contents of the table that they have access to.
703703
</para>
704704

705+
<para>
706+
Note that if you use this option currently, you probably also want
707+
the dump be in <command>INSERT</command> format, as the
708+
<command>COPY FROM</command> during restore does not support row security.
709+
</para>
705710
</listitem>
706711
</varlistentry>
707712

doc/src/sgml/ref/pg_restore.sgml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -527,7 +527,7 @@
527527

528528
<para>
529529
Note that this option currently also requires the dump be in <command>INSERT</command>
530-
format, as <command>COPY TO</command> does not support row security.
530+
format, as <command>COPY FROM</command> does not support row security.
531531
</para>
532532
</listitem>
533533
</varlistentry>

0 commit comments

Comments
 (0)