aboutsummaryrefslogtreecommitdiff
path: root/doc/src
diff options
context:
space:
mode:
authorStephen Frost <sfrost@snowman.net>2014-10-03 16:31:53 -0400
committerStephen Frost <sfrost@snowman.net>2014-10-03 16:31:53 -0400
commit78d72563ef141ddc507ddd5ae77db613a309041a (patch)
tree0961d673236ce0e58a76d59b79aff7e1b5235fed /doc/src
parent596857043023738099d6d16f8edbe6b7353876c0 (diff)
downloadpostgresql-78d72563ef141ddc507ddd5ae77db613a309041a.tar.gz
postgresql-78d72563ef141ddc507ddd5ae77db613a309041a.zip
Fix CreatePolicy, pg_dump -v; psql and doc updates
Peter G pointed out that valgrind was, rightfully, complaining about CreatePolicy() ending up copying beyond the end of the parsed policy name. Name is a fixed-size type and we need to use namein (through DirectFunctionCall1()) to flush out the entire array before we pass it down to heap_form_tuple. Michael Paquier pointed out that pg_dump --verbose was missing a newline and Fabrízio de Royes Mello further pointed out that the schema was also missing from the messages, so fix those also. Also, based on an off-list comment from Kevin, rework the psql \d output to facilitate copy/pasting into a new CREATE or ALTER POLICY command. Lastly, improve the pg_policies view and update the documentation for it, along with a few other minor doc corrections based on an off-list discussion with Adam Brightwell.
Diffstat (limited to 'doc/src')
-rw-r--r--doc/src/sgml/catalogs.sgml91
1 files changed, 89 insertions, 2 deletions
diff --git a/doc/src/sgml/catalogs.sgml b/doc/src/sgml/catalogs.sgml
index a6ca290cb3d..f4617b67e95 100644
--- a/doc/src/sgml/catalogs.sgml
+++ b/doc/src/sgml/catalogs.sgml
@@ -5397,6 +5397,13 @@
</row>
<row>
+ <entry><structfield>rsecroles</structfield></entry>
+ <entry><type>char</type></entry>
+ <entry></entry>
+ <entry>The roles to which the row-security policy is applied.</entry>
+ </row>
+
+ <row>
<entry><structfield>rsecqual</structfield></entry>
<entry><type>pg_node_tree</type></entry>
<entry></entry>
@@ -5417,8 +5424,8 @@
<note>
<para>
<literal>pg_class.relrowsecurity</literal>
- True if the table has row-security enabled.
- Must be true if the table has a row-security policy in this catalog.
+ True if the table has row-security enabled. Policies will not be applied
+ unless row-security is enabled on the table.
</para>
</note>
@@ -7300,6 +7307,11 @@
</row>
<row>
+ <entry><link linkend="view-pg-policies"><structname>pg_policies</structname></link></entry>
+ <entry>policies</entry>
+ </row>
+
+ <row>
<entry><link linkend="view-pg-prepared-statements"><structname>pg_prepared_statements</structname></link></entry>
<entry>prepared statements</entry>
</row>
@@ -8146,6 +8158,81 @@ SELECT * FROM pg_locks pl LEFT JOIN pg_prepared_xacts ppx
</sect1>
+ <sect1 id="view-pg-policies">
+ <title><structname>pg_policies</structname></title>
+
+ <indexterm zone="view-pg-policies">
+ <primary>pg_policies</primary>
+ </indexterm>
+
+ <para>
+ The view <structname>pg_policies</structname> provides access to
+ useful information about each policy in the database.
+ </para>
+
+ <table>
+ <title><structname>pg_policies</> Columns</title>
+
+ <tgroup cols="4">
+ <thead>
+ <row>
+ <entry>Name</entry>
+ <entry>Type</entry>
+ <entry>References</entry>
+ <entry>Description</entry>
+ </row>
+ </thead>
+ <tbody>
+ <row>
+ <entry><structfield>schemaname</structfield></entry>
+ <entry><type>name</type></entry>
+ <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.nspname</literal></entry>
+ <entry>Name of schema containing table policy is on</entry>
+ </row>
+ <row>
+ <entry><structfield>tablename</structfield></entry>
+ <entry><type>name</type></entry>
+ <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relname</literal></entry>
+ <entry>Name of table policy is on</entry>
+ </row>
+ <row>
+ <entry><structfield>policyname</structfield></entry>
+ <entry><type>name</type></entry>
+ <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relname</literal></entry>
+ <entry>Name of policy</entry>
+ </row>
+ <row>
+ <entry><structfield>cmd</structfield></entry>
+ <entry><type>text</type></entry>
+ <entry></entry>
+ <entry>The command type to which the policy is applied.</entry>
+ </row>
+ <row>
+ <entry><structfield>roles</structfield></entry>
+ <entry><type>name[]</type></entry>
+ <entry></entry>
+ <entry>The roles to which this policy applies.</entry>
+ </row>
+ <row>
+ <entry><structfield>qual</structfield></entry>
+ <entry><type>text</type></entry>
+ <entry></entry>
+ <entry>The expression added to the security barrier qualifications for
+ queries which this policy applies to.</entry>
+ </row>
+ <row>
+ <entry><structfield>with_check</structfield></entry>
+ <entry><type>text</type></entry>
+ <entry></entry>
+ <entry>The expression added to the with check qualifications for
+ queries which attempt to add rows to this table.</entry>
+ </row>
+ </tbody>
+ </tgroup>
+ </table>
+
+ </sect1>
+
<sect1 id="view-pg-prepared-statements">
<title><structname>pg_prepared_statements</structname></title>