Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit42f66b2

Browse files
committed
Improve CREATE POLICY documentation
The CREATE POLICY documention didn't sufficiently clarify what happenswhen a given command type (eg: ALL or UPDATE) accepts both USING andWITH CHECK clauses, but only the USING clause is defined. Add languageto clarify that, in such a case, the USING clause will be used for bothUSING and WITH CHECK cases.Pointed out by Peter Geoghegan.
1 parentc7cf9a2 commit42f66b2

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

‎doc/src/sgml/ref/create_policy.sgml

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,11 @@ CREATE POLICY <replaceable class="parameter">name</replaceable> ON <replaceable
6363
Policies can be applied for specific commands or for specific roles. The
6464
default for newly created policies is that they apply for all commands and
6565
roles, unless otherwise specified. If multiple policies apply to a given
66-
query, they will be combined using OR.
66+
query, they will be combined using OR. Further, for commands which can have
67+
both USING and WITH CHECK policies (ALL and UPDATE), if no WITH CHECK policy
68+
is defined then the USING policy will be used for both what rows are visible
69+
(normal USING case) and which rows will be allowed to be added (WITH CHECK
70+
case).
6771
</para>
6872

6973
<para>
@@ -204,8 +208,10 @@ CREATE POLICY <replaceable class="parameter">name</replaceable> ON <replaceable
204208
(using the WITH CHECK expression, if defined, and the USING expression
205209
otherwise). If an INSERT or UPDATE command attempts to add rows to
206210
the table which do not pass the <literal>ALL</literal> WITH CHECK
207-
(or USING, if no WITH CHECK expression is defined) expression, the
208-
command will error.
211+
expression, the entire command will be aborted. Note that if only a
212+
<literal>USING</literal> clause is specified then that clause will be
213+
used for both <literal>USING</literal> and
214+
<literal>WITH CHECK</literal> cases.
209215
</para>
210216
</listitem>
211217
</varlistentry>
@@ -256,7 +262,10 @@ CREATE POLICY <replaceable class="parameter">name</replaceable> ON <replaceable
256262
relation (similar to the <literal>INSERT</literal> policy).
257263
Any rows whose resulting values do not pass the
258264
<literal>WITH CHECK</literal> expression will cause an ERROR and the
259-
entire command will be aborted.
265+
entire command will be aborted. Note that if only a
266+
<literal>USING</literal> clause is specified then that clause will be
267+
used for both <literal>USING</literal> and
268+
<literal>WITH CHECK</literal> cases.
260269
</para>
261270
</listitem>
262271
</varlistentry>

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp