1SECURITY LABEL(7) PostgreSQL 14.3 Documentation SECURITY LABEL(7)
2
3
4
6 SECURITY_LABEL - define or change a security label applied to an object
7
9 SECURITY LABEL [ FOR provider ] ON
10 {
11 TABLE object_name |
12 COLUMN table_name.column_name |
13 AGGREGATE aggregate_name ( aggregate_signature ) |
14 DATABASE object_name |
15 DOMAIN object_name |
16 EVENT TRIGGER object_name |
17 FOREIGN TABLE object_name
18 FUNCTION function_name [ ( [ [ argmode ] [ argname ] argtype [, ...] ] ) ] |
19 LARGE OBJECT large_object_oid |
20 MATERIALIZED VIEW object_name |
21 [ PROCEDURAL ] LANGUAGE object_name |
22 PROCEDURE procedure_name [ ( [ [ argmode ] [ argname ] argtype [, ...] ] ) ] |
23 PUBLICATION object_name |
24 ROLE object_name |
25 ROUTINE routine_name [ ( [ [ argmode ] [ argname ] argtype [, ...] ] ) ] |
26 SCHEMA object_name |
27 SEQUENCE object_name |
28 SUBSCRIPTION object_name |
29 TABLESPACE object_name |
30 TYPE object_name |
31 VIEW object_name
32 } IS 'label'
33
34 where aggregate_signature is:
35
36 * |
37 [ argmode ] [ argname ] argtype [ , ... ] |
38 [ [ argmode ] [ argname ] argtype [ , ... ] ] ORDER BY [ argmode ] [ argname ] argtype [ , ... ]
39
41 SECURITY LABEL applies a security label to a database object. An
42 arbitrary number of security labels, one per label provider, can be
43 associated with a given database object. Label providers are loadable
44 modules which register themselves by using the function
45 register_label_provider.
46
47 Note
48 register_label_provider is not an SQL function; it can only be
49 called from C code loaded into the backend.
50
51 The label provider determines whether a given label is valid and
52 whether it is permissible to assign that label to a given object. The
53 meaning of a given label is likewise at the discretion of the label
54 provider. PostgreSQL places no restrictions on whether or how a label
55 provider must interpret security labels; it merely provides a mechanism
56 for storing them. In practice, this facility is intended to allow
57 integration with label-based mandatory access control (MAC) systems
58 such as SELinux. Such systems make all access control decisions based
59 on object labels, rather than traditional discretionary access control
60 (DAC) concepts such as users and groups.
61
63 object_name
64 table_name.column_name
65 aggregate_name
66 function_name
67 procedure_name
68 routine_name
69 The name of the object to be labeled. Names of objects that reside
70 in schemas (tables, functions, etc.) can be schema-qualified.
71
72 provider
73 The name of the provider with which this label is to be associated.
74 The named provider must be loaded and must consent to the proposed
75 labeling operation. If exactly one provider is loaded, the provider
76 name may be omitted for brevity.
77
78 argmode
79 The mode of a function, procedure, or aggregate argument: IN, OUT,
80 INOUT, or VARIADIC. If omitted, the default is IN. Note that
81 SECURITY LABEL does not actually pay any attention to OUT
82 arguments, since only the input arguments are needed to determine
83 the function's identity. So it is sufficient to list the IN, INOUT,
84 and VARIADIC arguments.
85
86 argname
87 The name of a function, procedure, or aggregate argument. Note that
88 SECURITY LABEL does not actually pay any attention to argument
89 names, since only the argument data types are needed to determine
90 the function's identity.
91
92 argtype
93 The data type of a function, procedure, or aggregate argument.
94
95 large_object_oid
96 The OID of the large object.
97
98 PROCEDURAL
99 This is a noise word.
100
101 label
102 The new security label, written as a string literal; or NULL to
103 drop the security label.
104
106 The following example shows how the security label of a table might be
107 changed.
108
109 SECURITY LABEL FOR selinux ON TABLE mytable IS 'system_u:object_r:sepgsql_table_t:s0';
110
112 There is no SECURITY LABEL command in the SQL standard.
113
115 sepgsql, src/test/modules/dummy_seclabel
116
117
118
119PostgreSQL 14.3 2022 SECURITY LABEL(7)