Home Explore Blog CI



postgresql

68th chunk of `doc/src/sgml/catalogs.sgml`
a93c99bfa34c9292d9c73b28dfdff492320653b2a041105a0000000100000fa0
 <row>
      <entry role="catalog_table_entry"><para role="column_definition">
       <structfield>partcollation</structfield> <type>oidvector</type>
       (references <link linkend="catalog-pg-collation"><structname>pg_collation</structname></link>.<structfield>oid</structfield>)
      </para>
      <para>
       For each column in the partition key, this contains the OID of the
       collation to use for partitioning, or zero if the column is not
       of a collatable data type.
      </para></entry>
     </row>

     <row>
      <entry role="catalog_table_entry"><para role="column_definition">
       <structfield>partexprs</structfield> <type>pg_node_tree</type>
      </para>
      <para>
       Expression trees (in <function>nodeToString()</function>
       representation) for partition key columns that are not simple column
       references.  This is a list with one element for each zero
       entry in <structfield>partattrs</structfield>.  Null if all partition key columns
       are simple references.
      </para></entry>
     </row>
    </tbody>
   </tgroup>
  </table>
 </sect1>


 <sect1 id="catalog-pg-policy">
  <title><structname>pg_policy</structname></title>

  <indexterm zone="catalog-pg-policy">
   <primary>pg_policy</primary>
  </indexterm>

  <para>
   The catalog <structname>pg_policy</structname> stores row-level
   security policies for tables.  A policy includes the kind of
   command that it applies to (possibly all commands), the roles that it
   applies to, the expression to be added as a security-barrier
   qualification to queries that include the table, and the expression
   to be added as a <literal>WITH CHECK</literal> option for queries that attempt to
   add new records to the table.
  </para>

  <table>
   <title><structname>pg_policy</structname> Columns</title>
   <tgroup cols="1">
    <thead>
     <row>
      <entry role="catalog_table_entry"><para role="column_definition">
       Column Type
      </para>
      <para>
       Description
      </para></entry>
     </row>
    </thead>

    <tbody>
     <row>
      <entry role="catalog_table_entry"><para role="column_definition">
       <structfield>oid</structfield> <type>oid</type>
      </para>
      <para>
       Row identifier
      </para></entry>
     </row>

     <row>
      <entry role="catalog_table_entry"><para role="column_definition">
       <structfield>polname</structfield> <type>name</type>
      </para>
      <para>
       The name of the policy
      </para></entry>
     </row>

     <row>
      <entry role="catalog_table_entry"><para role="column_definition">
       <structfield>polrelid</structfield> <type>oid</type>
       (references <link linkend="catalog-pg-class"><structname>pg_class</structname></link>.<structfield>oid</structfield>)
      </para>
      <para>
       The table to which the policy applies
      </para></entry>
     </row>

     <row>
      <entry role="catalog_table_entry"><para role="column_definition">
       <structfield>polcmd</structfield> <type>char</type>
      </para>
      <para>
       The command type to which the policy is applied:
       <literal>r</literal> for <xref linkend="sql-select"/>,
       <literal>a</literal> for <xref linkend="sql-insert"/>,
       <literal>w</literal> for <xref linkend="sql-update"/>,
       <literal>d</literal> for <xref linkend="sql-delete"/>,
       or <literal>*</literal> for all
      </para></entry>
     </row>

     <row>
      <entry role="catalog_table_entry"><para role="column_definition">
       <structfield>polpermissive</structfield> <type>bool</type>
      </para>
      <para>
       Is the policy permissive or restrictive?
      </para></entry>
     </row>

     <row>
      <entry role="catalog_table_entry"><para role="column_definition">
       <structfield>polroles</structfield> <type>oid[]</type>
       (references <link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.<structfield>oid</structfield>)
      </para>
   

Title: pg_policy Catalog and its Columns
Summary
This section describes the `pg_policy` catalog, which stores row-level security policies for tables. It outlines the catalog's purpose: defining policies for commands, roles, and security expressions. It then lists and explains the columns within `pg_policy`, including `oid` (row identifier), `polname` (policy name), `polrelid` (table the policy applies to), `polcmd` (command type the policy applies to), `polpermissive` (whether the policy is permissive or restrictive), and `polroles` (roles the policy applies to).