]> git.ipfire.org Git - thirdparty/postgresql.git/commitdiff
Doc: clarify use of NULL to drop comments and security labels.
authorTom Lane <tgl@sss.pgh.pa.us>
Tue, 31 Jan 2023 19:32:24 +0000 (14:32 -0500)
committerTom Lane <tgl@sss.pgh.pa.us>
Tue, 31 Jan 2023 19:33:24 +0000 (14:33 -0500)
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

doc/src/sgml/ref/comment.sgml
doc/src/sgml/ref/security_label.sgml

index 138cf718ce11ea2973e065fd3c779c2964e47dd4..ab69bd68c8910b12d409feea3d1bd870852157b1 100644 (file)
@@ -66,7 +66,7 @@ COMMENT ON
   TRIGGER <replaceable class="parameter">trigger_name</replaceable> ON <replaceable class="parameter">table_name</replaceable> |
   TYPE <replaceable class="parameter">object_name</replaceable> |
   VIEW <replaceable class="parameter">object_name</replaceable>
-} IS '<replaceable class="parameter">text</replaceable>'
+} IS { <replaceable class="parameter">string_literal</replaceable> | NULL }
 
 <phrase>where <replaceable>aggregate_signature</replaceable> is:</phrase>
 
@@ -264,11 +264,19 @@ COMMENT ON
     </varlistentry>
 
    <varlistentry>
-    <term><replaceable class="parameter">text</replaceable></term>
+    <term><replaceable class="parameter">string_literal</replaceable></term>
     <listitem>
      <para>
-      The new comment, written as a string literal; or <literal>NULL</literal>
-      to drop the comment.
+      The new comment contents, written as a string literal.
+     </para>
+    </listitem>
+   </varlistentry>
+
+   <varlistentry>
+    <term><literal>NULL</literal></term>
+    <listitem>
+     <para>
+      Write <literal>NULL</literal> to drop the comment.
      </para>
     </listitem>
    </varlistentry>
index e9688cce214b22c56ccac4a0898876ab4dab7adb..720f319c8b2c829d9dfb267b3acfd7710d6610f8 100644 (file)
@@ -44,7 +44,7 @@ SECURITY LABEL [ FOR <replaceable class="parameter">provider</replaceable> ] ON
   TABLESPACE <replaceable class="parameter">object_name</replaceable> |
   TYPE <replaceable class="parameter">object_name</replaceable> |
   VIEW <replaceable class="parameter">object_name</replaceable>
-} IS '<replaceable class="parameter">label</replaceable>'
+} IS { <replaceable class="parameter">string_literal</replaceable> | NULL }
 
 <phrase>where <replaceable>aggregate_signature</replaceable> is:</phrase>
 
@@ -179,11 +179,19 @@ SECURITY LABEL [ FOR <replaceable class="parameter">provider</replaceable> ] ON
     </varlistentry>
 
    <varlistentry>
-    <term><replaceable class="parameter">label</replaceable></term>
+    <term><replaceable class="parameter">string_literal</replaceable></term>
     <listitem>
      <para>
-      The new security label, written as a string literal; or <literal>NULL</literal>
-      to drop the security label.
+      The new setting of the security label, written as a string literal.
+     </para>
+    </listitem>
+   </varlistentry>
+
+   <varlistentry>
+    <term><literal>NULL</literal></term>
+    <listitem>
+     <para>
+      Write <literal>NULL</literal> to drop the security label.
      </para>
     </listitem>
    </varlistentry>
@@ -194,12 +202,19 @@ SECURITY LABEL [ FOR <replaceable class="parameter">provider</replaceable> ] ON
   <title>Examples</title>
 
   <para>
-   The following example shows how the security label of a table might
-   be changed.
+   The following example shows how the security label of a table could
+   be set or changed:
 
 <programlisting>
 SECURITY LABEL FOR selinux ON TABLE mytable IS 'system_u:object_r:sepgsql_table_t:s0';
-</programlisting></para>
+</programlisting>
+
+   To remove the label:
+
+<programlisting>
+SECURITY LABEL FOR selinux ON TABLE mytable IS NULL;
+</programlisting>
+  </para>
  </refsect1>
 
  <refsect1>