Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 04ef404

Browse files
committed
Update SET CONSTRAINTS reference page --- it failed to mention EXCLUDE
constraints and was lacking a couple of other interesting details.
1 parent 9a915e5 commit 04ef404

File tree

1 file changed

+25
-10
lines changed

1 file changed

+25
-10
lines changed

doc/src/sgml/ref/set_constraints.sgml

+25-10
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<!-- $PostgreSQL: pgsql/doc/src/sgml/ref/set_constraints.sgml,v 1.17 2009/07/29 20:56:17 tgl Exp $ -->
1+
<!-- $PostgreSQL: pgsql/doc/src/sgml/ref/set_constraints.sgml,v 1.18 2010/01/18 00:32:21 tgl Exp $ -->
22
<refentry id="SQL-SET-CONSTRAINTS">
33
<refmeta>
44
<refentrytitle id="SQL-SET-CONSTRAINTS-title">SET CONSTRAINTS</refentrytitle>
@@ -8,7 +8,7 @@
88

99
<refnamediv>
1010
<refname>SET CONSTRAINTS</refname>
11-
<refpurpose>set constraint checking modes for the current transaction</refpurpose>
11+
<refpurpose>set constraint check timing for the current transaction</refpurpose>
1212
</refnamediv>
1313

1414
<indexterm zone="sql-set-constraints">
@@ -46,7 +46,8 @@ SET CONSTRAINTS { ALL | <replaceable class="parameter">name</replaceable> [, ...
4646

4747
<para>
4848
<command>SET CONSTRAINTS</command> with a list of constraint names changes
49-
the mode of just those constraints (which must all be deferrable). The
49+
the mode of just those constraints (which must all be deferrable). Each
50+
constraint name can be schema-qualified. The
5051
current schema search path is used to find the first matching name if
5152
no schema name is specified. <command>SET CONSTRAINTS ALL</command>
5253
changes the mode of all deferrable constraints.
@@ -66,13 +67,14 @@ SET CONSTRAINTS { ALL | <replaceable class="parameter">name</replaceable> [, ...
6667
</para>
6768

6869
<para>
69-
Currently, only <literal>UNIQUE</>, <literal>PRIMARY KEY</>, and
70-
<literal>REFERENCES</> (foreign key) constraints are affected by this
71-
setting. <literal>NOT NULL</> and <literal>CHECK</> constraints are
70+
Currently, only <literal>UNIQUE</>, <literal>PRIMARY KEY</>,
71+
<literal>REFERENCES</> (foreign key), and <literal>EXCLUDE</>
72+
constraints are affected by this setting.
73+
<literal>NOT NULL</> and <literal>CHECK</> constraints are
7274
always checked immediately when a row is inserted or modified
7375
(<emphasis>not</> at the end of the statement).
74-
Uniqueness constraints that have not been declared <literal>DEFERRABLE</>
75-
are also checked immediately.
76+
Uniqueness and exclusion constraints that have not been declared
77+
<literal>DEFERRABLE</> are also checked immediately.
7678
</para>
7779

7880
<para>
@@ -85,6 +87,16 @@ SET CONSTRAINTS { ALL | <replaceable class="parameter">name</replaceable> [, ...
8587
<refsect1>
8688
<title>Notes</title>
8789

90+
<para>
91+
Because <productname>PostgreSQL</productname> does not require constraint
92+
names to be unique within a schema (but only per-table), it is possible
93+
that there is more than one match for a specified constraint name.
94+
In this case <command>SET CONSTRAINTS</command> will act on all matches.
95+
For a non-schema-qualified name, once a match or matches have been found in
96+
some schema in the search path, schemas appearing later in the path are not
97+
searched.
98+
</para>
99+
88100
<para>
89101
This command only alters the behavior of constraints within the
90102
current transaction. Thus, if you execute this command outside of a
@@ -100,8 +112,11 @@ SET CONSTRAINTS { ALL | <replaceable class="parameter">name</replaceable> [, ...
100112
<para>
101113
This command complies with the behavior defined in the SQL
102114
standard, except for the limitation that, in
103-
<productname>PostgreSQL</productname>, it only applies to
104-
foreign-key and uniqueness constraints.
115+
<productname>PostgreSQL</productname>, it does not apply to
116+
<literal>NOT NULL</> and <literal>CHECK</> constraints.
117+
Also, <productname>PostgreSQL</productname> checks non-deferrable
118+
uniqueness constraints immediately, not at end of statement as the
119+
standard would suggest.
105120
</para>
106121

107122
</refsect1>

0 commit comments

Comments
 (0)