Doc: add a summary table to the CREATE POLICY docs.
authorDean Rasheed
Fri, 24 Nov 2017 12:00:37 +0000 (12:00 +0000)
committerDean Rasheed
Fri, 24 Nov 2017 12:00:37 +0000 (12:00 +0000)
This table summarizes which RLS policy expressions apply to each
command type, and whether they apply to the old or new tuples (or
both), which saves reading through a lot of text.

Rod Taylor, hacked on by me. Reviewed by Fabien Coelho.

Discussion: https://postgr.es/m/CAHz80e4HxJShm6m9ZWFrHW=pgd2KP=RZmfFnEccujtPMiAOW5Q@mail.gmail.com

doc/src/sgml/ref/create_policy.sgml

index 70df22c0593e64a754a6e508f8454e93285e5818..44b179e6ef4d7a9f07dac77a5817b48866aab285 100644 (file)
@@ -73,7 +73,10 @@ CREATE POLICY name ON 
   
    Policies can be applied for specific commands or for specific roles.  The
    default for newly created policies is that they apply for all commands and
-   roles, unless otherwise specified.
+   roles, unless otherwise specified.  Multiple policies may apply to a single
+   command; see below for more details.
+    summarizes how the different types
+   of policy apply to specific commands.
   
 
   
@@ -391,6 +394,105 @@ CREATE POLICY name ON 
      
 
    
+
+   
+    Policies Applied by Command Type
+    
+     
+     
+     
+     
+      
+       Command
+       SELECT/ALL policy
+       INSERT/ALL policy
+       UPDATE/ALL policy
+       DELETE/ALL policy
+      
+      
+       USING expression
+       WITH CHECK expression
+       USING expression
+       WITH CHECK expression
+       USING expression
+      
+     
+     
+      
+       SELECT
+       Existing row
+       
+       
+       
+       
+      
+      
+       SELECT FOR UPDATE/SHARE
+       Existing row
+       
+       Existing row
+       
+       
+      
+      
+       INSERT
+       
+       New row
+       
+       
+       
+      
+      
+       INSERT ... RETURNING
+       
+        New row
+        
+         
+          If read access is required to the existing or new row (for example,
+          a WHERE or RETURNING clause
+          that refers to columns from the relation).
+         
+        
+       
+       New row
+       
+       
+       
+      
+      
+       UPDATE
+       
+        Existing & new rows
+        
+       
+       
+       Existing row
+       New row
+       
+      
+      
+       DELETE
+       
+        Existing row
+        
+       
+       
+       
+       
+       Existing row
+      
+      
+       ON CONFLICT DO UPDATE
+       Existing & new rows
+       
+       Existing row
+       New row
+       
+      
+     
+    
+   
+