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 $ -->
2
2
<refentry id="SQL-SET-CONSTRAINTS">
3
3
<refmeta>
4
4
<refentrytitle id="SQL-SET-CONSTRAINTS-title">SET CONSTRAINTS</refentrytitle>
8
8
9
9
<refnamediv>
10
10
<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>
12
12
</refnamediv>
13
13
14
14
<indexterm zone="sql-set-constraints">
@@ -46,7 +46,8 @@ SET CONSTRAINTS { ALL | <replaceable class="parameter">name</replaceable> [, ...
46
46
47
47
<para>
48
48
<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
50
51
current schema search path is used to find the first matching name if
51
52
no schema name is specified. <command>SET CONSTRAINTS ALL</command>
52
53
changes the mode of all deferrable constraints.
@@ -66,13 +67,14 @@ SET CONSTRAINTS { ALL | <replaceable class="parameter">name</replaceable> [, ...
66
67
</para>
67
68
68
69
<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
72
74
always checked immediately when a row is inserted or modified
73
75
(<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.
76
78
</para>
77
79
78
80
<para>
@@ -85,6 +87,16 @@ SET CONSTRAINTS { ALL | <replaceable class="parameter">name</replaceable> [, ...
85
87
<refsect1>
86
88
<title>Notes</title>
87
89
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
+
88
100
<para>
89
101
This command only alters the behavior of constraints within the
90
102
current transaction. Thus, if you execute this command outside of a
@@ -100,8 +112,11 @@ SET CONSTRAINTS { ALL | <replaceable class="parameter">name</replaceable> [, ...
100
112
<para>
101
113
This command complies with the behavior defined in the SQL
102
114
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.
105
120
</para>
106
121
107
122
</refsect1>
0 commit comments