From 856ca51a23b56df6aab3ee9bffc66334b79be355 Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Tue, 31 Jan 2023 14:32:24 -0500 Subject: [PATCH] Doc: clarify use of NULL to drop comments and security labels. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 | 16 +++++++++++---- doc/src/sgml/ref/security_label.sgml | 29 +++++++++++++++++++++------- 2 files changed, 34 insertions(+), 11 deletions(-) diff --git a/doc/src/sgml/ref/comment.sgml b/doc/src/sgml/ref/comment.sgml index 7499da1d62..5b43c56b13 100644 --- a/doc/src/sgml/ref/comment.sgml +++ b/doc/src/sgml/ref/comment.sgml @@ -66,7 +66,7 @@ COMMENT ON TRIGGER trigger_name ON table_name | TYPE object_name | VIEW object_name -} IS 'text' +} IS { string_literal | NULL } where aggregate_signature is: @@ -263,11 +263,19 @@ COMMENT ON - text + string_literal - The new comment, written as a string literal; or NULL - to drop the comment. + The new comment contents, written as a string literal. + + + + + + NULL + + + Write NULL to drop the comment. diff --git a/doc/src/sgml/ref/security_label.sgml b/doc/src/sgml/ref/security_label.sgml index 20a839ff0c..5f96b7e1de 100644 --- a/doc/src/sgml/ref/security_label.sgml +++ b/doc/src/sgml/ref/security_label.sgml @@ -44,7 +44,7 @@ SECURITY LABEL [ FOR provider ] ON TABLESPACE object_name | TYPE object_name | VIEW object_name -} IS 'label' +} IS { string_literal | NULL } where aggregate_signature is: @@ -178,11 +178,19 @@ SECURITY LABEL [ FOR provider ] ON - label + string_literal - The new security label, written as a string literal; or NULL - to drop the security label. + The new setting of the security label, written as a string literal. + + + + + + NULL + + + Write NULL to drop the security label. @@ -193,12 +201,19 @@ SECURITY LABEL [ FOR provider ] ON Examples - 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: SECURITY LABEL FOR selinux ON TABLE mytable IS 'system_u:object_r:sepgsql_table_t:s0'; - + + + To remove the label: + + +SECURITY LABEL FOR selinux ON TABLE mytable IS NULL; + +