Improve RLS documentation with respect to COPY
authorJoe Conway
Fri, 23 Dec 2016 01:57:01 +0000 (17:57 -0800)
committerJoe Conway
Fri, 23 Dec 2016 01:57:01 +0000 (17:57 -0800)
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

doc/src/sgml/ref/copy.sgml
doc/src/sgml/ref/pg_dump.sgml
doc/src/sgml/ref/pg_restore.sgml

index 07e2f45196f054a7be134b1b8b4b19089086de02..8ad547272fc92f2f92ef4d1275df6a1f75c69e71 100644 (file)
@@ -418,6 +418,15 @@ COPY count
     to have column privileges on the column(s) listed in the command.
    
 
+   
+    If row-level security is enabled for the table, the relevant 
+    SELECT policies will apply to COPY
+    table TO statements.
+    Currently, COPY FROM is not supported for tables
+    with row-level security. Use equivalent INSERT
+    statements instead.
+   
+
    
     Files named in a COPY command are read or written
     directly by the server, not by the client application. Therefore,
index f1e60bb51b19a4719a3596a1e8c72999d945470d..038a376f4a7a0a5f1599eb9a32c5992f99c27867 100644 (file)
@@ -702,6 +702,11 @@ PostgreSQL documentation
         to dump the parts of the contents of the table that they have access to.
        
 
+       
+        Note that if you use this option currently, you probably also want
+        the dump be in INSERT format, as the
+        COPY FROM during restore does not support row security.
+       
       
      
 
index c9069193afcce0901fb289db96f9b9817b365055..ef5bab40d1dde00cb4902ac7d85b01b1650ae8e3 100644 (file)
 
        
         Note that this option currently also requires the dump be in INSERT
-        format, as COPY TO does not support row security.
+        format, as COPY FROM does not support row security.