Skip to content

Commit 856ca51

Browse files
committed
Doc: clarify use of NULL to drop comments and security labels.
This was only mentioned in the description of the text/label, which are marked as being in quotes in the synopsis, which can cause confusion (as witnessed on IRC). Also separate the literal and NULL cases in the parameter list, per suggestion from Tom Lane. Also add an example of dropping a security label. Dagfinn Ilmari Mannsåker, with some tweaks by me Discussion: https://postgr.es/m/87sffqk4zp.fsf@wibble.ilmari.org
1 parent eae0e20 commit 856ca51

File tree

2 files changed

+34
-11
lines changed

2 files changed

+34
-11
lines changed

doc/src/sgml/ref/comment.sgml

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ COMMENT ON
6666
TRIGGER <replaceable class="parameter">trigger_name</replaceable> ON <replaceable class="parameter">table_name</replaceable> |
6767
TYPE <replaceable class="parameter">object_name</replaceable> |
6868
VIEW <replaceable class="parameter">object_name</replaceable>
69-
} IS '<replaceable class="parameter">text</replaceable>'
69+
} IS { <replaceable class="parameter">string_literal</replaceable> | NULL }
7070

7171
<phrase>where <replaceable>aggregate_signature</replaceable> is:</phrase>
7272

@@ -263,11 +263,19 @@ COMMENT ON
263263
</varlistentry>
264264

265265
<varlistentry>
266-
<term><replaceable class="parameter">text</replaceable></term>
266+
<term><replaceable class="parameter">string_literal</replaceable></term>
267267
<listitem>
268268
<para>
269-
The new comment, written as a string literal; or <literal>NULL</literal>
270-
to drop the comment.
269+
The new comment contents, written as a string literal.
270+
</para>
271+
</listitem>
272+
</varlistentry>
273+
274+
<varlistentry>
275+
<term><literal>NULL</literal></term>
276+
<listitem>
277+
<para>
278+
Write <literal>NULL</literal> to drop the comment.
271279
</para>
272280
</listitem>
273281
</varlistentry>

doc/src/sgml/ref/security_label.sgml

Lines changed: 22 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ SECURITY LABEL [ FOR <replaceable class="parameter">provider</replaceable> ] ON
4444
TABLESPACE <replaceable class="parameter">object_name</replaceable> |
4545
TYPE <replaceable class="parameter">object_name</replaceable> |
4646
VIEW <replaceable class="parameter">object_name</replaceable>
47-
} IS '<replaceable class="parameter">label</replaceable>'
47+
} IS { <replaceable class="parameter">string_literal</replaceable> | NULL }
4848

4949
<phrase>where <replaceable>aggregate_signature</replaceable> is:</phrase>
5050

@@ -178,11 +178,19 @@ SECURITY LABEL [ FOR <replaceable class="parameter">provider</replaceable> ] ON
178178
</varlistentry>
179179

180180
<varlistentry>
181-
<term><replaceable class="parameter">label</replaceable></term>
181+
<term><replaceable class="parameter">string_literal</replaceable></term>
182182
<listitem>
183183
<para>
184-
The new security label, written as a string literal; or <literal>NULL</literal>
185-
to drop the security label.
184+
The new setting of the security label, written as a string literal.
185+
</para>
186+
</listitem>
187+
</varlistentry>
188+
189+
<varlistentry>
190+
<term><literal>NULL</literal></term>
191+
<listitem>
192+
<para>
193+
Write <literal>NULL</literal> to drop the security label.
186194
</para>
187195
</listitem>
188196
</varlistentry>
@@ -193,12 +201,19 @@ SECURITY LABEL [ FOR <replaceable class="parameter">provider</replaceable> ] ON
193201
<title>Examples</title>
194202

195203
<para>
196-
The following example shows how the security label of a table might
197-
be changed.
204+
The following example shows how the security label of a table could
205+
be set or changed:
198206

199207
<programlisting>
200208
SECURITY LABEL FOR selinux ON TABLE mytable IS 'system_u:object_r:sepgsql_table_t:s0';
201-
</programlisting></para>
209+
</programlisting>
210+
211+
To remove the label:
212+
213+
<programlisting>
214+
SECURITY LABEL FOR selinux ON TABLE mytable IS NULL;
215+
</programlisting>
216+
</para>
202217
</refsect1>
203218

204219
<refsect1>

0 commit comments

Comments
 (0)