SECURITY LABEL(7)       PostgreSQL 9.5.3 Documentation       SECURITY LABEL(7)



NNAAMMEE
       SECURITY_LABEL - define or change a security label applied to an object

SSYYNNOOPPSSIISS
       SECURITY LABEL [ FOR _p_r_o_v_i_d_e_r ] ON
       {
         TABLE _o_b_j_e_c_t___n_a_m_e |
         COLUMN _t_a_b_l_e___n_a_m_e._c_o_l_u_m_n___n_a_m_e |
         AGGREGATE _a_g_g_r_e_g_a_t_e___n_a_m_e ( _a_g_g_r_e_g_a_t_e___s_i_g_n_a_t_u_r_e ) |
         DATABASE _o_b_j_e_c_t___n_a_m_e |
         DOMAIN _o_b_j_e_c_t___n_a_m_e |
         EVENT TRIGGER _o_b_j_e_c_t___n_a_m_e |
         FOREIGN TABLE _o_b_j_e_c_t___n_a_m_e
         FUNCTION _f_u_n_c_t_i_o_n___n_a_m_e ( [ [ _a_r_g_m_o_d_e ] [ _a_r_g_n_a_m_e ] _a_r_g_t_y_p_e [, ...] ] ) |
         LARGE OBJECT _l_a_r_g_e___o_b_j_e_c_t___o_i_d |
         MATERIALIZED VIEW _o_b_j_e_c_t___n_a_m_e |
         [ PROCEDURAL ] LANGUAGE _o_b_j_e_c_t___n_a_m_e |
         ROLE _o_b_j_e_c_t___n_a_m_e |
         SCHEMA _o_b_j_e_c_t___n_a_m_e |
         SEQUENCE _o_b_j_e_c_t___n_a_m_e |
         TABLESPACE _o_b_j_e_c_t___n_a_m_e |
         TYPE _o_b_j_e_c_t___n_a_m_e |
         VIEW _o_b_j_e_c_t___n_a_m_e
       } IS '_l_a_b_e_l'

       where _a_g_g_r_e_g_a_t_e___s_i_g_n_a_t_u_r_e is:

       * |
       [ _a_r_g_m_o_d_e ] [ _a_r_g_n_a_m_e ] _a_r_g_t_y_p_e [ , ... ] |
       [ [ _a_r_g_m_o_d_e ] [ _a_r_g_n_a_m_e ] _a_r_g_t_y_p_e [ , ... ] ] ORDER BY [ _a_r_g_m_o_d_e ] [ _a_r_g_n_a_m_e ] _a_r_g_t_y_p_e [ , ... ]

DDEESSCCRRIIPPTTIIOONN
       SSEECCUURRIITTYY LLAABBEELL applies a security label to a database object. An
       arbitrary number of security labels, one per label provider, can be
       associated with a given database object. Label providers are loadable
       modules which register themselves by using the function
       rreeggiisstteerr__llaabbeell__pprroovviiddeerr.

           NNoottee
           rreeggiisstteerr__llaabbeell__pprroovviiddeerr is not an SQL function; it can only be
           called from C code loaded into the backend.

       The label provider determines whether a given label is valid and
       whether it is permissible to assign that label to a given object. The
       meaning of a given label is likewise at the discretion of the label
       provider.  PostgreSQL places no restrictions on whether or how a label
       provider must interpret security labels; it merely provides a mechanism
       for storing them. In practice, this facility is intended to allow
       integration with label-based mandatory access control (MAC) systems
       such as SE-Linux. Such systems make all access control decisions based
       on object labels, rather than traditional discretionary access control
       (DAC) concepts such as users and groups.

PPAARRAAMMEETTEERRSS
       _o_b_j_e_c_t___n_a_m_e
       _t_a_b_l_e___n_a_m_e_._c_o_l_u_m_n___n_a_m_e
       _a_g_g_r_e_g_a_t_e___n_a_m_e
       _f_u_n_c_t_i_o_n___n_a_m_e
           The name of the object to be labeled. Names of tables, aggregates,
           domains, foreign tables, functions, sequences, types, and views can
           be schema-qualified.

       _p_r_o_v_i_d_e_r
           The name of the provider with which this label is to be associated.
           The named provider must be loaded and must consent to the proposed
           labeling operation. If exactly one provider is loaded, the provider
           name may be omitted for brevity.

       _a_r_g_m_o_d_e
           The mode of a function or aggregate argument: IN, OUT, INOUT, or
           VARIADIC. If omitted, the default is IN. Note that SSEECCUURRIITTYY LLAABBEELL
           does not actually pay any attention to OUT arguments, since only
           the input arguments are needed to determine the function's
           identity. So it is sufficient to list the IN, INOUT, and VARIADIC
           arguments.

       _a_r_g_n_a_m_e
           The name of a function or aggregate argument. Note that SSEECCUURRIITTYY
           LLAABBEELL does not actually pay any attention to argument names, since
           only the argument data types are needed to determine the function's
           identity.

       _a_r_g_t_y_p_e
           The data type of a function or aggregate argument.

       _l_a_r_g_e___o_b_j_e_c_t___o_i_d
           The OID of the large object.

       PROCEDURAL
           This is a noise word.

       _l_a_b_e_l
           The new security label, written as a string literal; or NULL to
           drop the security label.

EEXXAAMMPPLLEESS
       The following example shows how the security label of a table might be
       changed.

           SECURITY LABEL FOR selinux ON TABLE mytable IS 'system_u:object_r:sepgsql_table_t:s0';

CCOOMMPPAATTIIBBIILLIITTYY
       There is no SSEECCUURRIITTYY LLAABBEELL command in the SQL standard.

SSEEEE AALLSSOO
       sepgsql, src/test/modules/dummy_seclabel



PostgreSQL 9.5.3                     2016                    SECURITY LABEL(7)
