Team Ai
Datasetpublic

codekingpro/portable-devtools

sourceHugging Faceupdated 5mo agoView on Hugging Face
1likes15kdownloads
sql-security-label.html101 linesDownload Raw Back to html
1<?xml version="1.0" encoding="UTF-8" standalone="no"?>2<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>SECURITY LABEL</title><link rel="stylesheet" type="text/css" href="stylesheet.css" /><link rev="made" href="pgsql-docs@lists.postgresql.org" /><meta name="generator" content="DocBook XSL Stylesheets Vsnapshot" /><link rel="prev" href="sql-savepoint.html" title="SAVEPOINT" /><link rel="next" href="sql-select.html" title="SELECT" /></head><body id="docContent" class="container-fluid col-10"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="5" align="center">SECURITY LABEL</th></tr><tr><td width="10%" align="left"><a accesskey="p" href="sql-savepoint.html" title="SAVEPOINT">Prev</a> </td><td width="10%" align="left"><a accesskey="u" href="sql-commands.html" title="SQL Commands">Up</a></td><th width="60%" align="center">SQL Commands</th><td width="10%" align="right"><a accesskey="h" href="index.html" title="PostgreSQL 16.3 Documentation">Home</a></td><td width="10%" align="right"> <a accesskey="n" href="sql-select.html" title="SELECT">Next</a></td></tr></table><hr /></div><div class="refentry" id="SQL-SECURITY-LABEL"><div class="titlepage"></div><a id="id-1.9.3.171.1" class="indexterm"></a><div class="refnamediv"><h2><span class="refentrytitle">SECURITY LABEL</span></h2><p>SECURITY LABEL — define or change a security label applied to an object</p></div><div class="refsynopsisdiv"><h2>Synopsis</h2><pre class="synopsis">3SECURITY LABEL [ FOR <em class="replaceable"><code>provider</code></em> ] ON4{5  TABLE <em class="replaceable"><code>object_name</code></em> |6  COLUMN <em class="replaceable"><code>table_name</code></em>.<em class="replaceable"><code>column_name</code></em> |7  AGGREGATE <em class="replaceable"><code>aggregate_name</code></em> ( <em class="replaceable"><code>aggregate_signature</code></em> ) |8  DATABASE <em class="replaceable"><code>object_name</code></em> |9  DOMAIN <em class="replaceable"><code>object_name</code></em> |10  EVENT TRIGGER <em class="replaceable"><code>object_name</code></em> |11  FOREIGN TABLE <em class="replaceable"><code>object_name</code></em> |12  FUNCTION <em class="replaceable"><code>function_name</code></em> [ ( [ [ <em class="replaceable"><code>argmode</code></em> ] [ <em class="replaceable"><code>argname</code></em> ] <em class="replaceable"><code>argtype</code></em> [, ...] ] ) ] |13  LARGE OBJECT <em class="replaceable"><code>large_object_oid</code></em> |14  MATERIALIZED VIEW <em class="replaceable"><code>object_name</code></em> |15  [ PROCEDURAL ] LANGUAGE <em class="replaceable"><code>object_name</code></em> |16  PROCEDURE <em class="replaceable"><code>procedure_name</code></em> [ ( [ [ <em class="replaceable"><code>argmode</code></em> ] [ <em class="replaceable"><code>argname</code></em> ] <em class="replaceable"><code>argtype</code></em> [, ...] ] ) ] |17  PUBLICATION <em class="replaceable"><code>object_name</code></em> |18  ROLE <em class="replaceable"><code>object_name</code></em> |19  ROUTINE <em class="replaceable"><code>routine_name</code></em> [ ( [ [ <em class="replaceable"><code>argmode</code></em> ] [ <em class="replaceable"><code>argname</code></em> ] <em class="replaceable"><code>argtype</code></em> [, ...] ] ) ] |20  SCHEMA <em class="replaceable"><code>object_name</code></em> |21  SEQUENCE <em class="replaceable"><code>object_name</code></em> |22  SUBSCRIPTION <em class="replaceable"><code>object_name</code></em> |23  TABLESPACE <em class="replaceable"><code>object_name</code></em> |24  TYPE <em class="replaceable"><code>object_name</code></em> |25  VIEW <em class="replaceable"><code>object_name</code></em>26} IS { <em class="replaceable"><code>string_literal</code></em> | NULL }27 28<span class="phrase">where <em class="replaceable"><code>aggregate_signature</code></em> is:</span>29 30* |31[ <em class="replaceable"><code>argmode</code></em> ] [ <em class="replaceable"><code>argname</code></em> ] <em class="replaceable"><code>argtype</code></em> [ , ... ] |32[ [ <em class="replaceable"><code>argmode</code></em> ] [ <em class="replaceable"><code>argname</code></em> ] <em class="replaceable"><code>argtype</code></em> [ , ... ] ] ORDER BY [ <em class="replaceable"><code>argmode</code></em> ] [ <em class="replaceable"><code>argname</code></em> ] <em class="replaceable"><code>argtype</code></em> [ , ... ]33</pre></div><div class="refsect1" id="id-1.9.3.171.5"><h2>Description</h2><p>34   <code class="command">SECURITY LABEL</code> applies a security label to a database35   object.  An arbitrary number of security labels, one per label provider, can36   be associated with a given database object.  Label providers are loadable37   modules which register themselves by using the function38   <code class="function">register_label_provider</code>.39  </p><div class="note"><h3 class="title">Note</h3><p>40      <code class="function">register_label_provider</code> is not an SQL function; it can41      only be called from C code loaded into the backend.42    </p></div><p>43   The label provider determines whether a given label is valid and whether44   it is permissible to assign that label to a given object.  The meaning of a45   given label is likewise at the discretion of the label provider.46   <span class="productname">PostgreSQL</span> places no restrictions on whether or how a47   label provider must interpret security labels; it merely provides a48   mechanism for storing them.  In practice, this facility is intended to allow49   integration with label-based mandatory access control (MAC) systems such as50   <span class="productname">SELinux</span>.  Such systems make all access control decisions51   based on object labels, rather than traditional discretionary access control52   (DAC) concepts such as users and groups.53  </p></div><div class="refsect1" id="id-1.9.3.171.6"><h2>Parameters</h2><div class="variablelist"><dl class="variablelist"><dt><span class="term"><em class="replaceable"><code>object_name</code></em><br /></span><span class="term"><em class="replaceable"><code>table_name.column_name</code></em><br /></span><span class="term"><em class="replaceable"><code>aggregate_name</code></em><br /></span><span class="term"><em class="replaceable"><code>function_name</code></em><br /></span><span class="term"><em class="replaceable"><code>procedure_name</code></em><br /></span><span class="term"><em class="replaceable"><code>routine_name</code></em></span></dt><dd><p>54      The name of the object to be labeled.  Names of objects that reside in55      schemas (tables, functions, etc.) can be schema-qualified.56     </p></dd><dt><span class="term"><em class="replaceable"><code>provider</code></em></span></dt><dd><p>57      The name of the provider with which this label is to be associated.  The58      named provider must be loaded and must consent to the proposed labeling59      operation.  If exactly one provider is loaded, the provider name may be60      omitted for brevity.61     </p></dd><dt><span class="term"><em class="replaceable"><code>argmode</code></em></span></dt><dd><p>62      The mode of a function, procedure, or aggregate63      argument: <code class="literal">IN</code>, <code class="literal">OUT</code>,64      <code class="literal">INOUT</code>, or <code class="literal">VARIADIC</code>.65      If omitted, the default is <code class="literal">IN</code>.66      Note that <code class="command">SECURITY LABEL</code> does not actually67      pay any attention to <code class="literal">OUT</code> arguments, since only the input68      arguments are needed to determine the function's identity.69      So it is sufficient to list the <code class="literal">IN</code>, <code class="literal">INOUT</code>,70      and <code class="literal">VARIADIC</code> arguments.71     </p></dd><dt><span class="term"><em class="replaceable"><code>argname</code></em></span></dt><dd><p>72      The name of a function, procedure, or aggregate argument.73      Note that <code class="command">SECURITY LABEL</code> does not actually74      pay any attention to argument names, since only the argument data75      types are needed to determine the function's identity.76     </p></dd><dt><span class="term"><em class="replaceable"><code>argtype</code></em></span></dt><dd><p>77      The data type of a function, procedure, or aggregate argument.78     </p></dd><dt><span class="term"><em class="replaceable"><code>large_object_oid</code></em></span></dt><dd><p>79      The OID of the large object.80     </p></dd><dt><span class="term"><code class="literal">PROCEDURAL</code></span></dt><dd><p>81       This is a noise word.82      </p></dd><dt><span class="term"><em class="replaceable"><code>string_literal</code></em></span></dt><dd><p>83      The new setting of the security label, written as a string literal.84     </p></dd><dt><span class="term"><code class="literal">NULL</code></span></dt><dd><p>85      Write <code class="literal">NULL</code> to drop the security label.86     </p></dd></dl></div></div><div class="refsect1" id="id-1.9.3.171.7"><h2>Examples</h2><p>87   The following example shows how the security label of a table could88   be set or changed:89 90</p><pre class="programlisting">91SECURITY LABEL FOR selinux ON TABLE mytable IS 'system_u:object_r:sepgsql_table_t:s0';92</pre><p>93 94   To remove the label:95 96</p><pre class="programlisting">97SECURITY LABEL FOR selinux ON TABLE mytable IS NULL;98</pre><p>99  </p></div><div class="refsect1" id="id-1.9.3.171.8"><h2>Compatibility</h2><p>100   There is no <code class="command">SECURITY LABEL</code> command in the SQL standard.101  </p></div><div class="refsect1" id="id-1.9.3.171.9"><h2>See Also</h2><span class="simplelist"><a class="xref" href="sepgsql.html" title="F.40. sepgsql — SELinux-, label-based mandatory access control (MAC) security module">sepgsql</a>, <code class="filename">src/test/modules/dummy_seclabel</code></span></div></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="sql-savepoint.html" title="SAVEPOINT">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="sql-commands.html" title="SQL Commands">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="sql-select.html" title="SELECT">Next</a></td></tr><tr><td width="40%" align="left" valign="top">SAVEPOINT </td><td width="20%" align="center"><a accesskey="h" href="index.html" title="PostgreSQL 16.3 Documentation">Home</a></td><td width="40%" align="right" valign="top"> SELECT</td></tr></table></div></body></html>
codekingpro/portable-devtools · Team Ai