mirror of
https://git.postgresql.org/git/postgresql.git
synced 2024-12-21 08:29:39 +08:00
Update SET CONSTRAINTS reference page --- it failed to mention EXCLUDE
constraints and was lacking a couple of other interesting details.
This commit is contained in:
parent
9a915e596f
commit
04ef404018
@ -1,4 +1,4 @@
|
||||
<!-- $PostgreSQL: pgsql/doc/src/sgml/ref/set_constraints.sgml,v 1.17 2009/07/29 20:56:17 tgl Exp $ -->
|
||||
<!-- $PostgreSQL: pgsql/doc/src/sgml/ref/set_constraints.sgml,v 1.18 2010/01/18 00:32:21 tgl Exp $ -->
|
||||
<refentry id="SQL-SET-CONSTRAINTS">
|
||||
<refmeta>
|
||||
<refentrytitle id="SQL-SET-CONSTRAINTS-title">SET CONSTRAINTS</refentrytitle>
|
||||
@ -8,7 +8,7 @@
|
||||
|
||||
<refnamediv>
|
||||
<refname>SET CONSTRAINTS</refname>
|
||||
<refpurpose>set constraint checking modes for the current transaction</refpurpose>
|
||||
<refpurpose>set constraint check timing for the current transaction</refpurpose>
|
||||
</refnamediv>
|
||||
|
||||
<indexterm zone="sql-set-constraints">
|
||||
@ -46,7 +46,8 @@ SET CONSTRAINTS { ALL | <replaceable class="parameter">name</replaceable> [, ...
|
||||
|
||||
<para>
|
||||
<command>SET CONSTRAINTS</command> with a list of constraint names changes
|
||||
the mode of just those constraints (which must all be deferrable). The
|
||||
the mode of just those constraints (which must all be deferrable). Each
|
||||
constraint name can be schema-qualified. The
|
||||
current schema search path is used to find the first matching name if
|
||||
no schema name is specified. <command>SET CONSTRAINTS ALL</command>
|
||||
changes the mode of all deferrable constraints.
|
||||
@ -66,13 +67,14 @@ SET CONSTRAINTS { ALL | <replaceable class="parameter">name</replaceable> [, ...
|
||||
</para>
|
||||
|
||||
<para>
|
||||
Currently, only <literal>UNIQUE</>, <literal>PRIMARY KEY</>, and
|
||||
<literal>REFERENCES</> (foreign key) constraints are affected by this
|
||||
setting. <literal>NOT NULL</> and <literal>CHECK</> constraints are
|
||||
Currently, only <literal>UNIQUE</>, <literal>PRIMARY KEY</>,
|
||||
<literal>REFERENCES</> (foreign key), and <literal>EXCLUDE</>
|
||||
constraints are affected by this setting.
|
||||
<literal>NOT NULL</> and <literal>CHECK</> constraints are
|
||||
always checked immediately when a row is inserted or modified
|
||||
(<emphasis>not</> at the end of the statement).
|
||||
Uniqueness constraints that have not been declared <literal>DEFERRABLE</>
|
||||
are also checked immediately.
|
||||
Uniqueness and exclusion constraints that have not been declared
|
||||
<literal>DEFERRABLE</> are also checked immediately.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
@ -85,6 +87,16 @@ SET CONSTRAINTS { ALL | <replaceable class="parameter">name</replaceable> [, ...
|
||||
<refsect1>
|
||||
<title>Notes</title>
|
||||
|
||||
<para>
|
||||
Because <productname>PostgreSQL</productname> does not require constraint
|
||||
names to be unique within a schema (but only per-table), it is possible
|
||||
that there is more than one match for a specified constraint name.
|
||||
In this case <command>SET CONSTRAINTS</command> will act on all matches.
|
||||
For a non-schema-qualified name, once a match or matches have been found in
|
||||
some schema in the search path, schemas appearing later in the path are not
|
||||
searched.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
This command only alters the behavior of constraints within the
|
||||
current transaction. Thus, if you execute this command outside of a
|
||||
@ -100,8 +112,11 @@ SET CONSTRAINTS { ALL | <replaceable class="parameter">name</replaceable> [, ...
|
||||
<para>
|
||||
This command complies with the behavior defined in the SQL
|
||||
standard, except for the limitation that, in
|
||||
<productname>PostgreSQL</productname>, it only applies to
|
||||
foreign-key and uniqueness constraints.
|
||||
<productname>PostgreSQL</productname>, it does not apply to
|
||||
<literal>NOT NULL</> and <literal>CHECK</> constraints.
|
||||
Also, <productname>PostgreSQL</productname> checks non-deferrable
|
||||
uniqueness constraints immediately, not at end of statement as the
|
||||
standard would suggest.
|
||||
</para>
|
||||
|
||||
</refsect1>
|
||||
|
Loading…
Reference in New Issue
Block a user