mirror of
https://github.com/postgres/postgres.git
synced 2025-05-01 01:04:50 +03:00
Improve CREATE POLICY documentation
The CREATE POLICY documention didn't sufficiently clarify what happens when a given command type (eg: ALL or UPDATE) accepts both USING and WITH CHECK clauses, but only the USING clause is defined. Add language to clarify that, in such a case, the USING clause will be used for both USING and WITH CHECK cases. Pointed out by Peter Geoghegan.
This commit is contained in:
parent
c7cf9a2433
commit
42f66b2756
@ -63,7 +63,11 @@ CREATE POLICY <replaceable class="parameter">name</replaceable> ON <replaceable
|
|||||||
Policies can be applied for specific commands or for specific roles. The
|
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
|
default for newly created policies is that they apply for all commands and
|
||||||
roles, unless otherwise specified. If multiple policies apply to a given
|
roles, unless otherwise specified. If multiple policies apply to a given
|
||||||
query, they will be combined using OR.
|
query, they will be combined using OR. Further, for commands which can have
|
||||||
|
both USING and WITH CHECK policies (ALL and UPDATE), if no WITH CHECK policy
|
||||||
|
is defined then the USING policy will be used for both what rows are visible
|
||||||
|
(normal USING case) and which rows will be allowed to be added (WITH CHECK
|
||||||
|
case).
|
||||||
</para>
|
</para>
|
||||||
|
|
||||||
<para>
|
<para>
|
||||||
@ -204,8 +208,10 @@ CREATE POLICY <replaceable class="parameter">name</replaceable> ON <replaceable
|
|||||||
(using the WITH CHECK expression, if defined, and the USING expression
|
(using the WITH CHECK expression, if defined, and the USING expression
|
||||||
otherwise). If an INSERT or UPDATE command attempts to add rows to
|
otherwise). If an INSERT or UPDATE command attempts to add rows to
|
||||||
the table which do not pass the <literal>ALL</literal> WITH CHECK
|
the table which do not pass the <literal>ALL</literal> WITH CHECK
|
||||||
(or USING, if no WITH CHECK expression is defined) expression, the
|
expression, the entire command will be aborted. Note that if only a
|
||||||
command will error.
|
<literal>USING</literal> clause is specified then that clause will be
|
||||||
|
used for both <literal>USING</literal> and
|
||||||
|
<literal>WITH CHECK</literal> cases.
|
||||||
</para>
|
</para>
|
||||||
</listitem>
|
</listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
@ -256,7 +262,10 @@ CREATE POLICY <replaceable class="parameter">name</replaceable> ON <replaceable
|
|||||||
relation (similar to the <literal>INSERT</literal> policy).
|
relation (similar to the <literal>INSERT</literal> policy).
|
||||||
Any rows whose resulting values do not pass the
|
Any rows whose resulting values do not pass the
|
||||||
<literal>WITH CHECK</literal> expression will cause an ERROR and the
|
<literal>WITH CHECK</literal> expression will cause an ERROR and the
|
||||||
entire command will be aborted.
|
entire command will be aborted. Note that if only a
|
||||||
|
<literal>USING</literal> clause is specified then that clause will be
|
||||||
|
used for both <literal>USING</literal> and
|
||||||
|
<literal>WITH CHECK</literal> cases.
|
||||||
</para>
|
</para>
|
||||||
</listitem>
|
</listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user