postgresql/doc/src/sgml/reference.sgml
Stephen Frost 491c029dbc Row-Level Security Policies (RLS)
Building on the updatable security-barrier views work, add the
ability to define policies on tables to limit the set of rows
which are returned from a query and which are allowed to be added
to a table.  Expressions defined by the policy for filtering are
added to the security barrier quals of the query, while expressions
defined to check records being added to a table are added to the
with-check options of the query.

New top-level commands are CREATE/ALTER/DROP POLICY and are
controlled by the table owner.  Row Security is able to be enabled
and disabled by the owner on a per-table basis using
ALTER TABLE .. ENABLE/DISABLE ROW SECURITY.

Per discussion, ROW SECURITY is disabled on tables by default and
must be enabled for policies on the table to be used.  If no
policies exist on a table with ROW SECURITY enabled, a default-deny
policy is used and no records will be visible.

By default, row security is applied at all times except for the
table owner and the superuser.  A new GUC, row_security, is added
which can be set to ON, OFF, or FORCE.  When set to FORCE, row
security will be applied even for the table owner and superusers.
When set to OFF, row security will be disabled when allowed and an
error will be thrown if the user does not have rights to bypass row
security.

Per discussion, pg_dump sets row_security = OFF by default to ensure
that exports and backups will have all data in the table or will
error if there are insufficient privileges to bypass row security.
A new option has been added to pg_dump, --enable-row-security, to
ask pg_dump to export with row security enabled.

A new role capability, BYPASSRLS, which can only be set by the
superuser, is added to allow other users to be able to bypass row
security using row_security = OFF.

Many thanks to the various individuals who have helped with the
design, particularly Robert Haas for his feedback.

Authors include Craig Ringer, KaiGai Kohei, Adam Brightwell, Dean
Rasheed, with additional changes and rework by me.

Reviewers have included all of the above, Greg Smith,
Jeff McCormick, and Robert Haas.
2014-09-19 11:18:35 -04:00

269 lines
5.5 KiB
Plaintext

<!-- doc/src/sgml/reference.sgml -->
<part id="reference">
<title>Reference</title>
<partintro>
<para>
The entries in this Reference are meant to provide in reasonable
length an authoritative, complete, and formal summary about their
respective subjects. More information about the use of
<productname>PostgreSQL</productname>, in narrative, tutorial, or
example form, can be found in other parts of this book. See the
cross-references listed on each reference page.
</para>
<para>
The reference entries are also available as traditional
<quote>man</quote> pages.
</para>
</partintro>
<reference id="sql-commands">
<title>SQL Commands</title>
<partintro>
<para>
This part contains reference information for the
<acronym>SQL</acronym> commands supported by
<productname>PostgreSQL</productname>. By <quote>SQL</quote> the
language in general is meant; information about the standards
conformance and compatibility of each command can be found on the
respective reference page.
</para>
</partintro>
&abort;
&alterAggregate;
&alterCollation;
&alterConversion;
&alterDatabase;
&alterDefaultPrivileges;
&alterDomain;
&alterEventTrigger;
&alterExtension;
&alterForeignDataWrapper;
&alterForeignTable;
&alterFunction;
&alterGroup;
&alterIndex;
&alterLanguage;
&alterLargeObject;
&alterMaterializedView;
&alterOperator;
&alterOperatorClass;
&alterOperatorFamily;
&alterPolicy;
&alterRole;
&alterRule;
&alterSchema;
&alterSequence;
&alterServer;
&alterSystem;
&alterTable;
&alterTableSpace;
&alterTSConfig;
&alterTSDictionary;
&alterTSParser;
&alterTSTemplate;
&alterTrigger;
&alterType;
&alterUser;
&alterUserMapping;
&alterView;
&analyze;
&begin;
&checkpoint;
&close;
&cluster;
&commentOn;
&commit;
&commitPrepared;
&copyTable;
&createAggregate;
&createCast;
&createCollation;
&createConversion;
&createDatabase;
&createDomain;
&createEventTrigger;
&createExtension;
&createForeignDataWrapper;
&createForeignTable;
&createFunction;
&createGroup;
&createIndex;
&createLanguage;
&createMaterializedView;
&createOperator;
&createOperatorClass;
&createOperatorFamily;
&createPolicy;
&createRole;
&createRule;
&createSchema;
&createSequence;
&createServer;
&createTable;
&createTableAs;
&createTableSpace;
&createTSConfig;
&createTSDictionary;
&createTSParser;
&createTSTemplate;
&createTrigger;
&createType;
&createUser;
&createUserMapping;
&createView;
&deallocate;
&declare;
&delete;
&discard;
&do;
&dropAggregate;
&dropCast;
&dropCollation;
&dropConversion;
&dropDatabase;
&dropDomain;
&dropEventTrigger;
&dropExtension;
&dropForeignDataWrapper;
&dropForeignTable;
&dropFunction;
&dropGroup;
&dropIndex;
&dropLanguage;
&dropMaterializedView;
&dropOperator;
&dropOperatorClass;
&dropOperatorFamily;
&dropOwned;
&dropPolicy;
&dropRole;
&dropRule;
&dropSchema;
&dropSequence;
&dropServer;
&dropTable;
&dropTableSpace;
&dropTSConfig;
&dropTSDictionary;
&dropTSParser;
&dropTSTemplate;
&dropTrigger;
&dropType;
&dropUser;
&dropUserMapping;
&dropView;
&end;
&execute;
&explain;
&fetch;
&grant;
&importForeignSchema;
&insert;
&listen;
&load;
&lock;
&move;
&notify;
&prepare;
&prepareTransaction;
&reassignOwned;
&refreshMaterializedView;
&reindex;
&releaseSavepoint;
&reset;
&revoke;
&rollback;
&rollbackPrepared;
&rollbackTo;
&savepoint;
&securityLabel;
&select;
&selectInto;
&set;
&setConstraints;
&setRole;
&setSessionAuth;
&setTransaction;
&show;
&startTransaction;
&truncate;
&unlisten;
&update;
&vacuum;
&values;
</reference>
<reference id="reference-client">
<title>PostgreSQL Client Applications</title>
<partintro>
<para>
This part contains reference information for
<productname>PostgreSQL</productname> client applications and
utilities. Not all of these commands are of general utility; some
might require special privileges. The common feature of these
applications is that they can be run on any host, independent of
where the database server resides.
</para>
<para>
When specified on the command line, user and database names have
their case preserved &mdash; the presence of spaces or special
characters might require quoting. Table names and other identifiers
do not have their case preserved, except where documented, and
might require quoting.
</para>
</partintro>
&clusterdb;
&createdb;
&createlang;
&createuser;
&dropdb;
&droplang;
&dropuser;
&ecpgRef;
&pgBasebackup;
&pgConfig;
&pgDump;
&pgDumpall;
&pgIsready;
&pgReceivexlog;
&pgRecvlogical;
&pgRestore;
&psqlRef;
&reindexdb;
&vacuumdb;
</reference>
<reference id="reference-server">
<title>PostgreSQL Server Applications</title>
<partintro>
<para>
This part contains reference information for
<productname>PostgreSQL</productname> server applications and
support utilities. These commands can only be run usefully on the
host where the database server resides. Other utility programs
are listed in <xref linkend="reference-client">.
</para>
</partintro>
&initdb;
&pgControldata;
&pgCtl;
&pgResetxlog;
&postgres;
&postmaster;
</reference>
</part>