head	1.19;
access;
symbols
	REL9_0_0:1.19
	REL9_1_ALPHA1:1.19
	REL9_0_RC1:1.19
	REL9_0_BETA4:1.19
	REL9_0_STABLE:1.19.0.2
	REL9_0_BETA3:1.19
	REL9_0_BETA2:1.19
	REL7_4_29:1.9
	REL8_0_25:1.12
	REL8_1_21:1.12
	REL8_2_17:1.14
	REL8_3_11:1.15
	REL8_4_4:1.16
	REL9_0_BETA1:1.19
	REL9_0_ALPHA5_BRANCH:1.18.0.4
	REL9_0_ALPHA5:1.18
	REL7_4_28:1.9
	REL8_0_24:1.12
	REL8_1_20:1.12
	REL8_2_16:1.14
	REL8_3_10:1.15
	REL8_4_3:1.16
	REL9_0_ALPHA4:1.18
	REL9_0_ALPHA4_BRANCH:1.18.0.2
	REL8_5_ALPHA3:1.17
	REL8_5_ALPHA3_BRANCH:1.17.0.6
	REL7_4_27:1.9
	REL8_0_23:1.12
	REL8_1_19:1.12
	REL8_2_15:1.14
	REL8_3_9:1.15
	REL8_4_2:1.16
	REL8_5_ALPHA2:1.17
	REL8_5_ALPHA2_BRANCH:1.17.0.4
	REL7_4_26:1.9
	REL8_0_22:1.12
	REL8_1_18:1.12
	REL8_2_14:1.14
	REL8_3_8:1.15
	REL8_4_1:1.16
	REL8_5_ALPHA1:1.17
	REL8_5_ALPHA1_BRANCH:1.17.0.2
	REL8_4_STABLE:1.16.0.2
	REL8_4_0:1.16
	REL8_4_RC2:1.16
	REL8_4_RC1:1.16
	REL8_4_BETA2:1.16
	REL8_4_BETA1:1.16
	REL7_4_25:1.9
	REL8_0_21:1.12
	REL8_1_17:1.12
	REL8_2_13:1.14
	REL8_3_7:1.15
	REL7_4_24:1.9
	REL8_0_20:1.12
	REL8_1_16:1.12
	REL8_2_12:1.14
	REL8_3_6:1.15
	REL7_4_23:1.9
	REL8_0_19:1.12
	REL8_1_15:1.12
	REL8_2_11:1.14
	REL8_3_5:1.15
	REL7_4_22:1.9
	REL8_0_18:1.12
	REL8_1_14:1.12
	REL8_2_10:1.14
	REL8_3_4:1.15
	REL7_4_21:1.9
	REL8_0_17:1.12
	REL8_1_13:1.12
	REL8_2_9:1.14
	REL8_3_3:1.15
	REL7_4_20:1.9
	REL8_0_16:1.12
	REL8_1_12:1.12
	REL8_2_8:1.14
	REL8_3_2:1.15
	REL8_2_7:1.14
	REL8_3_1:1.15
	REL8_3_STABLE:1.15.0.2
	REL8_3_0:1.15
	REL8_3_RC2:1.15
	REL7_3_21:1.5
	REL7_4_19:1.9
	REL8_0_15:1.12
	REL8_1_11:1.12
	REL8_2_6:1.14
	REL8_3_RC1:1.15
	REL8_3_BETA4:1.15
	REL8_3_BETA3:1.15
	REL8_3_BETA2:1.15
	REL8_3_BETA1:1.15
	REL7_3_20:1.5
	REL7_4_18:1.9
	REL8_0_14:1.12
	REL8_1_10:1.12
	REL8_2_5:1.14
	REL7_3_19:1.5
	REL7_4_17:1.9
	REL8_0_13:1.12
	REL8_1_9:1.12
	REL8_2_4:1.14
	REL8_0_12:1.12
	REL8_1_8:1.12
	REL8_2_3:1.14
	REL7_3_18:1.5
	REL7_4_16:1.9
	REL8_0_11:1.12
	REL8_1_7:1.12
	REL8_2_2:1.14
	REL8_0_10:1.12
	REL8_1_6:1.12
	REL8_2_1:1.14
	REL7_4_15:1.9
	REL7_3_17:1.5
	REL8_2_STABLE:1.14.0.2
	REL8_2_0:1.14
	REL8_2_RC1:1.14
	REL8_2_BETA3:1.14
	REL8_2_BETA2:1.14
	REL8_1_5:1.12
	REL8_0_9:1.12
	REL7_4_14:1.9
	REL7_3_16:1.5
	REL8_2_BETA1:1.14
	REL7_3_15:1.5
	REL7_4_13:1.9
	REL8_0_8:1.12
	REL8_1_4:1.12
	REL7_3_14:1.5
	REL7_4_12:1.9
	REL8_0_7:1.12
	REL8_1_3:1.12
	REL7_3_13:1.5
	REL7_4_11:1.9
	REL8_0_6:1.12
	REL8_1_2:1.12
	REL7_3_12:1.5
	REL7_4_10:1.9
	REL8_0_5:1.12
	REL8_1_1:1.12
	REL8_1_STABLE:1.12.0.6
	REL8_1_0:1.12
	REL8_1_0RC1:1.12
	REL8_1_0BETA4:1.12
	REL8_1_0BETA3:1.12
	REL7_3_11:1.5
	REL7_4_9:1.9
	REL8_0_4:1.12
	REL8_1_0BETA2:1.12
	REL8_1_0BETA1:1.12
	REL7_2_8:1.3
	REL7_3_10:1.5
	REL7_4_8:1.9
	REL8_0_3:1.12
	REL8_0_2:1.12
	REL7_2_7:1.3
	REL7_3_9:1.5
	REL7_4_7:1.9
	REL8_0_1:1.12
	REL8_0_STABLE:1.12.0.4
	REL8_0_0:1.12.0.2
	REL8_0_0RC5:1.12
	REL8_0_0RC4:1.12
	REL8_0_0RC3:1.12
	REL8_0_0RC2:1.12
	REL8_0_0RC1:1.12
	REL8_0_0BETA5:1.12
	REL8_0_0BETA4:1.12
	REL7_4_6:1.9
	REL7_3_8:1.5
	REL7_2_6:1.3
	REL8_0_0BETA3:1.12
	REL8_0_0BETA2:1.10
	REL7_2_5:1.3
	REL7_4_5:1.9
	REL7_3_7:1.5
	REL7_4_4:1.9
	REL8_0_0BETA1:1.10
	REL7_4_3:1.9
	REL7_4_2:1.9
	REL7_3_6:1.5
	REL7_4_1:1.9
	REL7_3_5:1.5
	REL7_4:1.9
	REL7_4_RC2:1.9
	REL7_4_STABLE:1.9.0.2
	REL7_4_RC1:1.9
	REL7_4_BETA5:1.9
	REL7_4_BETA4:1.9
	REL7_4_BETA3:1.8
	REL7_4_BETA2:1.6
	WIN32_DEV:1.6.0.2
	REL7_4_BETA1:1.6
	REL7_3_4:1.5
	REL7_3_2:1.5
	REL7_2_4:1.3
	REL7_3_STABLE:1.5.0.2
	REL7_2_3:1.3
	REL7_2_STABLE:1.3.0.2
	REL7_2:1.3
	REL7_2_RC2:1.3
	REL7_2_RC1:1.3
	REL7_2_BETA5:1.3
	REL7_2_BETA4:1.3
	REL7_2_BETA3:1.3
	REL7_2_BETA2:1.3
	REL7_2_BETA1:1.3
	REL7_1_2:1.2
	REL7_1_STABLE:1.2.0.2
	REL7_1_BETA:1.2
	REL7_1_BETA3:1.2
	REL7_1_BETA2:1.2
	REL7_1:1.2;
locks; strict;
comment	@# @;


1.19
date	2010.04.03.07.23.02;	author petere;	state Exp;
branches;
next	1.18;

1.18
date	2010.01.18.00.32.21;	author tgl;	state Exp;
branches;
next	1.17;

1.17
date	2009.07.29.20.56.17;	author tgl;	state Exp;
branches;
next	1.16;

1.16
date	2008.11.14.10.22.47;	author petere;	state Exp;
branches;
next	1.15;

1.15
date	2007.02.10.20.43.59;	author tgl;	state Exp;
branches;
next	1.14;

1.14
date	2006.09.16.00.30.20;	author momjian;	state Exp;
branches;
next	1.13;

1.13
date	2006.04.27.00.33.32;	author momjian;	state Exp;
branches;
next	1.12;

1.12
date	2004.09.10.18.39.53;	author tgl;	state Exp;
branches;
next	1.11;

1.11
date	2004.09.08.20.47.37;	author tgl;	state Exp;
branches;
next	1.10;

1.10
date	2003.11.29.19.51.39;	author pgsql;	state Exp;
branches;
next	1.9;

1.9
date	2003.09.22.00.16.58;	author petere;	state Exp;
branches;
next	1.8;

1.8
date	2003.09.11.21.42.20;	author momjian;	state Exp;
branches;
next	1.7;

1.7
date	2003.08.31.17.32.24;	author petere;	state Exp;
branches;
next	1.6;

1.6
date	2003.05.04.02.23.16;	author petere;	state Exp;
branches
	1.6.2.1;
next	1.5;

1.5
date	2002.08.17.12.15.48;	author momjian;	state Exp;
branches;
next	1.4;

1.4
date	2002.06.03.01.10.38;	author momjian;	state Exp;
branches;
next	1.3;

1.3
date	2001.09.03.12.57.50;	author petere;	state Exp;
branches;
next	1.2;

1.2
date	2000.07.14.15.27.14;	author thomas;	state Exp;
branches;
next	1.1;

1.1
date	2000.06.18.21.24.54;	author petere;	state Exp;
branches;
next	;

1.6.2.1
date	2003.09.07.04.36.46;	author momjian;	state Exp;
branches;
next	;


desc
@@


1.19
log
@Remove unnecessary xref endterm attributes and title ids

The endterm attribute is mainly useful when the toolchain does not support
automatic link target text generation for a particular situation.  In  the
past, this was required by the man page tools for all reference page links,
but that is no longer the case, and it now actually gets in the way of
proper automatic link text generation.  The only remaining use cases are
currently xrefs to refsects.
@
text
@<!-- $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>SET CONSTRAINTS</refentrytitle>
  <manvolnum>7</manvolnum>
  <refmiscinfo>SQL - Language Statements</refmiscinfo>
 </refmeta>

 <refnamediv>
  <refname>SET CONSTRAINTS</refname>
  <refpurpose>set constraint check timing for the current transaction</refpurpose>
 </refnamediv>

 <indexterm zone="sql-set-constraints">
  <primary>SET CONSTRAINTS</primary>
 </indexterm>

 <refsynopsisdiv>
<synopsis>
SET CONSTRAINTS { ALL | <replaceable class="parameter">name</replaceable> [, ...] } { DEFERRED | IMMEDIATE }
</synopsis>
 </refsynopsisdiv>

 <refsect1>
  <title>Description</title>

  <para>
   <command>SET CONSTRAINTS</command> sets the behavior of constraint
   checking within the current transaction. <literal>IMMEDIATE</literal>
   constraints are checked at the end of each
   statement. <literal>DEFERRED</literal> constraints are not checked until
   transaction commit.  Each constraint has its own
   <literal>IMMEDIATE</literal> or <literal>DEFERRED</literal> mode.
  </para>

  <para>
   Upon creation, a constraint is given one of three
   characteristics: <literal>DEFERRABLE INITIALLY DEFERRED</literal>,
   <literal>DEFERRABLE INITIALLY IMMEDIATE</literal>, or
   <literal>NOT DEFERRABLE</literal>. The third
   class is always <literal>IMMEDIATE</literal> and is not affected by the
   <command>SET CONSTRAINTS</command> command.  The first two classes start
   every transaction in the indicated mode, but their behavior can be changed
   within a transaction by <command>SET CONSTRAINTS</command>.
  </para>

  <para>
   <command>SET CONSTRAINTS</command> with a list of constraint names changes
   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.
  </para>

  <para>
   When <command>SET CONSTRAINTS</command> changes the mode of a constraint
   from <literal>DEFERRED</literal>
   to <literal>IMMEDIATE</literal>, the new mode takes effect
   retroactively: any outstanding data modifications that would have
   been checked at the end of the transaction are instead checked during the
   execution of the <command>SET CONSTRAINTS</command> command.
   If any such constraint is violated, the <command>SET CONSTRAINTS</command>
   fails (and does not change the constraint mode).  Thus, <command>SET
   CONSTRAINTS</command> can be used to force checking of constraints to
   occur at a specific point in a transaction.
  </para>

  <para>
   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 and exclusion constraints that have not been declared
   <literal>DEFERRABLE</> are also checked immediately.
  </para>

  <para>
   The firing of triggers that are declared as <quote>constraint triggers</>
   is also controlled by this setting &mdash; they fire at the same time
   that the associated constraint should be checked.
  </para>
 </refsect1>

 <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
   transaction block
   (<command>BEGIN</command>/<command>COMMIT</command> pair), it will
   not appear to have any effect.
  </para>
 </refsect1>

 <refsect1>
  <title>Compatibility</title>

  <para>
   This command complies with the behavior defined in the SQL
   standard, except for the limitation that, in
   <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>
</refentry>
@


1.18
log
@Update SET CONSTRAINTS reference page --- it failed to mention EXCLUDE
constraints and was lacking a couple of other interesting details.
@
text
@d1 1
a1 1
<!-- $PostgreSQL: pgsql/doc/src/sgml/ref/set_constraints.sgml,v 1.17 2009/07/29 20:56:17 tgl Exp $ -->
d4 1
a4 1
  <refentrytitle id="SQL-SET-CONSTRAINTS-title">SET CONSTRAINTS</refentrytitle>
@


1.17
log
@Support deferrable uniqueness constraints.

The current implementation fires an AFTER ROW trigger for each tuple that
looks like it might be non-unique according to the index contents at the
time of insertion.  This works well as long as there aren't many conflicts,
but won't scale to massive unique-key reassignments.  Improving that case
is a TODO item.

Dean Rasheed
@
text
@d1 1
a1 1
<!-- $PostgreSQL: pgsql/doc/src/sgml/ref/set_constraints.sgml,v 1.16 2008/11/14 10:22:47 petere Exp $ -->
d11 1
a11 1
  <refpurpose>set constraint checking modes for the current transaction</refpurpose>
d49 2
a50 1
   the mode of just those constraints (which must all be deferrable).  The
d70 4
a73 3
   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
d76 2
a77 2
   Uniqueness constraints that have not been declared <literal>DEFERRABLE</>
   are also checked immediately.
d91 10
d115 5
a119 2
   <productname>PostgreSQL</productname>, it only applies to
   foreign-key and uniqueness constraints.
@


1.16
log
@Set SQL man pages to be section 7 by default, and only transform them to
another section if required by the platform (instead of the old way of
building them in section "l" and always transforming them to the
platform-specific section).

This speeds up the installation on common platforms, and it avoids some
funny business with the man page tools and build process.
@
text
@d1 1
a1 1
<!-- $PostgreSQL: pgsql/doc/src/sgml/ref/set_constraints.sgml,v 1.15 2007/02/10 20:43:59 tgl Exp $ -->
d51 1
a51 1
   no schema name is specified.  <command>SET CONSTRAINTS ALL</command> 
d69 13
a81 4
   Currently, only foreign key constraints are affected by this
   setting. Check and unique constraints are always effectively
   not deferrable. Triggers that are declared as <quote>constraint
   triggers</> are also affected.
d104 1
a104 1
   foreign-key constraints.
@


1.15
log
@Improve documentation for CREATE CONSTRAINT TRIGGER.
@
text
@d1 1
a1 1
<!-- $PostgreSQL: pgsql/doc/src/sgml/ref/set_constraints.sgml,v 1.14 2006/09/16 00:30:20 momjian Exp $ -->
d5 1
@


1.14
log
@Remove emacs info from footer of SGML files.
@
text
@d1 1
a1 1
<!-- $PostgreSQL: pgsql/doc/src/sgml/ref/set_constraints.sgml,v 1.13 2006/04/27 00:33:32 momjian Exp $ -->
d70 2
a71 1
   not deferrable.
@


1.13
log
@Use schema search path to find the first matching contraint name for SET
CONSTRAINT, rather than affecting all constraints in all schemas (which
is what we used to do).  Also allow schema specifications.

Kris Jurka
@
text
@d1 1
a1 1
<!-- $PostgreSQL: pgsql/doc/src/sgml/ref/set_constraints.sgml,v 1.12 2004/09/10 18:39:53 tgl Exp $ -->
a97 17

<!-- Keep this comment at the end of the file
Local variables:
mode:sgml
sgml-omittag:nil
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
sgml-parent-document:nil
sgml-default-dtd-file:"../reference.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:("/usr/lib/sgml/catalog")
sgml-local-ecat-files:nil
End:
-->
@


1.12
log
@Fire non-deferred AFTER triggers immediately upon query completion,
rather than when returning to the idle loop.  This makes no particular
difference for interactively-issued queries, but it makes a big difference
for queries issued within functions: trigger execution now occurs before
the calling function is allowed to proceed.  This responds to numerous
complaints about nonintuitive behavior of foreign key checking, such as
http://archives.postgresql.org/pgsql-bugs/2004-09/msg00020.php, and
appears to be required by the SQL99 spec.
Also take the opportunity to simplify the data structures used for the
pending-trigger list, rename them for more clarity, and squeeze out a
bit of space.
@
text
@d1 1
a1 1
<!-- $PostgreSQL: pgsql-server/doc/src/sgml/ref/set_constraints.sgml,v 1.11 2004/09/08 20:47:37 tgl Exp $ -->
d48 4
a51 4
   the mode of just those constraints (which must all be deferrable).  If
   there are multiple constraints matching any given name, all are affected.
   <command>SET CONSTRAINTS ALL</command> changes the mode of all deferrable
   constraints.
a95 7
  <para>
   The SQL standard says that constraint names appearing in <command>SET
   CONSTRAINTS</command> can be schema-qualified.  This is not yet
   supported by <productname>PostgreSQL</productname>: the names must
   be unqualified, and all constraints matching the command will be
   affected no matter which schema they are in.
  </para>
@


1.11
log
@Clarify description of SET CONSTRAINTS.  Point out that it is still
missing the ability to schema-qualify constraint names.
@
text
@d1 1
a1 1
<!-- $PostgreSQL: pgsql-server/doc/src/sgml/ref/set_constraints.sgml,v 1.10 2003/11/29 19:51:39 pgsql Exp $ -->
d37 7
a43 7
   characteristics: <literal>INITIALLY DEFERRED</literal>,
   <literal>INITIALLY IMMEDIATE DEFERRABLE</literal>, or
   <literal>INITIALLY IMMEDIATE NOT DEFERRABLE</literal>. The third
   class is not affected by the <command>SET CONSTRAINTS</command>
   command.  The first two classes start every transaction in the
   indicated mode, but their behavior can be changed within a transaction
   by <command>SET CONSTRAINTS</command>.
d55 2
a56 1
   When you change the mode of a constraint from <literal>DEFERRED</literal>
d62 3
a64 1
   fails (and does not change the constraint mode).
d70 1
a70 1
   initially immediate not deferrable.
d82 1
a82 5
   not appear to have any effect.  If you wish to change the behavior
   of a constraint without needing to issue a <command>SET
   CONSTRAINTS</command> command in every transaction, specify
   <literal>INITIALLY DEFERRED</literal> or <literal>INITIALLY
   IMMEDIATE</literal> when you create the constraint.
@


1.10
log
@
$Header: -> $PostgreSQL Changes ...
@
text
@d1 1
a1 1
<!-- $PostgreSQL: /cvsroot/pgsql-server/doc/src/sgml/ref/set_constraints.sgml,v 1.9 2003/09/22 00:16:58 petere Exp $ -->
d10 1
a10 1
  <refpurpose>set the constraint mode of the current transaction</refpurpose>
d28 5
a32 4
   evaluation in the current transaction. In
   <literal>IMMEDIATE</literal> mode, constraints are checked at the
   end of each statement. In <literal>DEFERRED</literal> mode,
   constraints are not checked until transaction commit.
d36 1
a36 10
   When you change the mode of a constraint to be
   <literal>IMMEDIATE</literal>, the new constraint mode takes effect
   retroactively: any outstanding data modifications that would have
   been checked at the end of the transaction (when using
   <literal>DEFERRED</literal>) are instead checked during the
   execution of the <command>SET CONSTRAINTS</command> command.
  </para>

  <para>
   Upon creation, a constraint is always give one of three
d41 21
a61 1
   command.
d96 8
@


1.9
log
@Make the SQL command synopses appear less random.
@
text
@d1 1
a1 1
<!-- $Header: /cvsroot/pgsql-server/doc/src/sgml/ref/set_constraints.sgml,v 1.8 2003/09/11 21:42:20 momjian Exp $ -->
@


1.8
log
@This patch fixes a few missed GUC variables that were still upper case,
makes a few more small improvements to runtime.sgml, and makes some SGML
conventions more consistent.

Neil Conway
@
text
@d1 1
a1 1
<!-- $Header: /cvsroot/pgsql-server/doc/src/sgml/ref/set_constraints.sgml,v 1.7 2003/08/31 17:32:24 petere Exp $ -->
d19 1
a19 1
SET CONSTRAINTS { ALL | <replaceable class="parameter">constraint</replaceable> [, ...] } { DEFERRED | IMMEDIATE }
@


1.7
log
@Add/edit index entries.
@
text
@d1 1
a1 1
<!-- $Header: /cvsroot/pgsql-server/doc/src/sgml/ref/set_constraints.sgml,v 1.6 2003/05/04 02:23:16 petere Exp $ -->
d80 3
a82 2
   standard, except for the limitation that, in PostgreSQL, it only
   applies to foreign-key constraints.
@


1.6
log
@Last round of reference page editing.
@
text
@d1 1
a1 1
<!-- $Header: /cvsroot/pgsql-server/doc/src/sgml/ref/set_constraints.sgml,v 1.5 2002/08/17 12:15:48 momjian Exp $ -->
d12 4
@


1.6.2.1
log
@Update this branch to match CVS head, includes WIN32 improvements.
@
text
@d1 1
a1 1
<!-- $Header: /cvsroot/pgsql-server/doc/src/sgml/ref/set_constraints.sgml,v 1.7 2003/08/31 17:32:24 petere Exp $ -->
a11 4

 <indexterm zone="sql-set-constraints">
  <primary>SET CONSTRAINTS</primary>
 </indexterm>
@


1.5
log
@Improve documentation of trigger firing queue handling, cleanup.

Neil Conway
@
text
@d1 1
a1 1
<!-- $Header: /cvsroot/pgsql-server/doc/src/sgml/ref/set_constraints.sgml,v 1.4 2002/06/03 01:10:38 momjian Exp $ -->
d7 1
d12 1
d14 1
a14 4
  <refsynopsisdivinfo>
   <date>2000-06-01</date>
  </refsynopsisdivinfo>
  <synopsis>
d16 1
a16 1
  </synopsis>
d24 12
a35 25
   evaluation in the current transaction. In <option>IMMEDIATE
   </option> mode, constraints are checked at the end of each
   statement. In <option>DEFERRED</option> mode, constraints are not
   checked until transaction commit.
  </para>

  <note>
   <para>
	This command only alters the behavior of constraints within the
	current transaction. Thus, if you execute this command outside
	of an explicit transaction block (such as one started with
	<command>BEGIN</command>), it will not appear to have any effect.
	If you wish to change the behavior of a constraint without needing
	to issue a <command>SET CONSTRAINTS</command> command in every
	transaction, specify <option>INITIALLY DEFERRED</option> or
	<option>INITIALLY IMMEDIATE</option> when you create the constraint.
   </para>
  </note>

  <para>
   When you change the mode of a constraint to be <option>IMMEDIATE
   </option>, the new constraint mode takes effect retroactively:
   any outstanding data modifications that would have been checked
   at the end of the transaction (when using
   <option>DEFERRED</option>) are instead checked during the
d41 3
a43 3
   characteristics: <option>INITIALLY DEFERRED</option>,
   <option>INITIALLY IMMEDIATE DEFERRABLE</option>, or
   <option>INITIALLY IMMEDIATE NOT DEFERRABLE</option>. The third
d55 17
a71 1
 <refsect1 id="R1-SQL-SET-CONSTRAINT-3">
d74 5
a78 12
  <refsect2 id="R2-SQL-SET-CONSTRAINT-4">
   <title>SQL92, SQL99</title>

   <para>
    <command>SET CONSTRAINTS</command> is defined in
    <acronym>SQL92</acronym> and <acronym>SQL99</acronym>. The
    implementation in <productname>PostgreSQL</productname> complies
    with the behavior defined in the standard, except for the
    <productname>PostgreSQL</productname> limitation that <command>SET
    CONSTRAINTS</command> cannot be applied to check or unique constraints.
   </para>
  </refsect2>
@


1.4
log
@The attached patch fixes a typo in the documentation for SET
CONSTRAINTS.

Neil Conway <neilconway@@rogers.com>
@
text
@d1 1
a1 1
<!-- $Header: /cvsroot/pgsql/doc/src/sgml/ref/set_constraints.sgml,v 1.3 2001/09/03 12:57:50 petere Exp $ -->
d25 26
a50 4
   evaluation in the current transaction. In
   <option>IMMEDIATE</option> mode, constraints are checked at the end
   of each statement. In <option>DEFERRED</option> mode, constraints
   are not checked until transaction commit.
d77 5
a81 1
    <acronym>SQL92</acronym> and <acronym>SQL99</acronym>.
@


1.3
log
@Put some kind of grammatical uniformity in the <refpurpose> lines.
@
text
@d1 1
a1 1
<!-- $Header: /home/projects/pgsql/cvsroot/pgsql/doc/src/sgml/ref/set_constraints.sgml,v 1.2 2000/07/14 15:27:14 thomas Exp $ -->
d54 1
a54 1
    <command>SET CONSTRAINT</command> is defined in
@


1.2
log
@Add information on SET SESSION CHARACTERISTICS.
Fix references to pg_hba.conf(5) since that is no longer a man page.
Make minor repairs to "Compatibility" subsections.
@
text
@d1 1
a1 1
<!-- $Header: /home/projects/pgsql/cvsroot/pgsql/doc/src/sgml/ref/set_constraints.sgml,v 1.1 2000/06/18 21:24:54 petere Exp $ -->
d9 1
a9 1
  <refpurpose>Set the constraint mode of the current SQL-transaction</refpurpose>
@


1.1
log
@Separated set constraints and set transaction reference pages, revised set
reference page to new configuration system. Big update to administrator's
guide, chapters Runtime environment, Client authentication, and User
management, the latter two were part of the old Security chapter.
@
text
@d1 1
a1 1
<!-- $Header$ -->
d47 1
a47 1
 <refsect1>
d49 9
a57 3
  <para>
   SQL92, SQL99
  </para>
d60 17
@
