@@ -39,14 +39,21 @@ CREATE POLICY <replaceable class="parameter">name</replaceable> ON <replaceable
3939 </para>
4040
4141 <para>
42- A policy limits the ability to SELECT, INSERT, UPDATE, or DELETE rows
43- in a table to those rows which match the relevant policy expression.
44- Existing table rows are checked against the expression specified via
45- USING, while new rows that would be created via INSERT or UPDATE are
46- checked against the expression specified via WITH CHECK. Generally,
47- the system will enforce filter conditions imposed using security
48- policies prior to qualifications that appear in the query itself, in
49- order to the prevent the inadvertent exposure of the protected data to
42+ A policy grants the ability to SELECT, INSERT, UPDATE, or DELETE rows
43+ which match the relevant policy expression. Existing table rows are
44+ checked against the expression specified via USING, while new rows that
45+ would be created via INSERT or UPDATE are checked against the expression
46+ specified via WITH CHECK. When a USING expression returns true for a given
47+ row then that row is visible to the user, while if a false or null is
48+ returned then the row is not visible. When a WITH CHECK expression
49+ returns true for a row then that row is added, while if a false or null is
50+ returned then an error occurs.
51+ </para>
52+
53+ <para>
54+ Generally, the system will enforce filter conditions imposed using
55+ security policies prior to qualifications that appear in the query itself,
56+ in order to the prevent the inadvertent exposure of the protected data to
5057 user-defined functions which might not be trustworthy. However,
5158 functions and operators marked by the system (or the system
5259 administrator) as LEAKPROOF may be evaluated before policy
@@ -158,8 +165,10 @@ CREATE POLICY <replaceable class="parameter">name</replaceable> ON <replaceable
158165 Any <acronym>SQL</acronym> conditional expression (returning
159166 <type>boolean</type>). The conditional expression cannot contain
160167 any aggregate or window functions. This expression will be added
161- to queries that refer to the table if row level security is enabled,
162- and will allow access to rows matching the expression.
168+ to queries that refer to the table if row level security is enabled
169+ and rows for which the expression returns true will be visible. Any
170+ rows for which the expression returns false or null will not be
171+ visible to the user.
163172 </para>
164173 </listitem>
165174 </varlistentry>
@@ -172,9 +181,10 @@ CREATE POLICY <replaceable class="parameter">name</replaceable> ON <replaceable
172181 <type>boolean</type>). The conditional expression cannot contain
173182 any aggregate or window functions. This expression will be used with
174183 <command>INSERT</command> and <command>UPDATE</command> queries against
175- the table if row level security is enabled and an error will be thrown
176- if the expression evaluates to false for any of the records inserted
177- or any of the records which result from the update.
184+ the table if row level security is enabled and only rows where the
185+ expression evaluates to true will be allowed. An error will be thrown
186+ if the expression evaluates to false or null for any of the records
187+ inserted or any of the records which result from the update.
178188 </para>
179189 </listitem>
180190 </varlistentry>
0 commit comments