aboutsummaryrefslogtreecommitdiff
path: root/doc/src/sgml/ref/alter_domain.sgml
diff options
context:
space:
mode:
Diffstat (limited to 'doc/src/sgml/ref/alter_domain.sgml')
-rw-r--r--doc/src/sgml/ref/alter_domain.sgml45
1 files changed, 38 insertions, 7 deletions
diff --git a/doc/src/sgml/ref/alter_domain.sgml b/doc/src/sgml/ref/alter_domain.sgml
index 2a5a935edcd..cf504c3bcc9 100644
--- a/doc/src/sgml/ref/alter_domain.sgml
+++ b/doc/src/sgml/ref/alter_domain.sgml
@@ -28,10 +28,12 @@ ALTER DOMAIN <replaceable class="PARAMETER">name</replaceable>
ALTER DOMAIN <replaceable class="PARAMETER">name</replaceable>
{ SET | DROP } NOT NULL
ALTER DOMAIN <replaceable class="PARAMETER">name</replaceable>
- ADD <replaceable class="PARAMETER">domain_constraint</replaceable>
+ ADD <replaceable class="PARAMETER">domain_constraint</replaceable> [ NOT VALID ]
ALTER DOMAIN <replaceable class="PARAMETER">name</replaceable>
DROP CONSTRAINT <replaceable class="PARAMETER">constraint_name</replaceable> [ RESTRICT | CASCADE ]
ALTER DOMAIN <replaceable class="PARAMETER">name</replaceable>
+ VALIDATE CONSTRAINT <replaceable class="PARAMETER">constraint_name</replaceable>
+ALTER DOMAIN <replaceable class="PARAMETER">name</replaceable>
OWNER TO <replaceable class="PARAMETER">new_owner</replaceable>
ALTER DOMAIN <replaceable class="PARAMETER">name</replaceable>
SET SCHEMA <replaceable class="PARAMETER">new_schema</replaceable>
@@ -70,13 +72,19 @@ ALTER DOMAIN <replaceable class="PARAMETER">name</replaceable>
</varlistentry>
<varlistentry>
- <term>ADD <replaceable class="PARAMETER">domain_constraint</replaceable></term>
+ <term>ADD <replaceable class="PARAMETER">domain_constraint</replaceable> [ NOT VALID ]</term>
<listitem>
<para>
This form adds a new constraint to a domain using the same syntax as
<xref linkend="SQL-CREATEDOMAIN">.
- This will only succeed if all columns using the domain satisfy the
- new constraint.
+ When a new constraint is added to a domain, all columns using that
+ domain will be checked against the newly added constraint. These
+ checks can be suppressed by adding the new constraint using the
+ <literal>NOT VALID</literal> option; the constraint can later be made
+ valid using <command>ALTER DOMAIN ... VALIDATE CONSTRAINT</command>.
+ Newly inserted or updated rows are always checked against all
+ constraints, even those marked <literal>NOT VALID</literal>.
+ <literal>NOT VALID</> is only accepted for <literal>CHECK</> constraints.
</para>
</listitem>
</varlistentry>
@@ -91,6 +99,17 @@ ALTER DOMAIN <replaceable class="PARAMETER">name</replaceable>
</varlistentry>
<varlistentry>
+ <term>VALIDATE CONSTRAINT</term>
+ <listitem>
+ <para>
+ This form validates a constraint previously added as
+ <literal>NOT VALID</>, that is, verify that all data in columns using the
+ domain satisfy the specified constraint.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
<term>OWNER</term>
<listitem>
<para>
@@ -156,6 +175,16 @@ ALTER DOMAIN <replaceable class="PARAMETER">name</replaceable>
</varlistentry>
<varlistentry>
+ <term><replaceable class="PARAMETER">NOT VALID</replaceable></term>
+ <listitem>
+ <para>
+ Do not verify existing column data for constraint validity.
+ </para>
+ </listitem>
+ </varlistentry>
+
+
+ <varlistentry>
<term><literal>CASCADE</literal></term>
<listitem>
<para>
@@ -250,9 +279,11 @@ ALTER DOMAIN zipcode SET SCHEMA customers;
<para>
<command>ALTER DOMAIN</command> conforms to the <acronym>SQL</acronym>
- standard,
- except for the <literal>OWNER</> and <literal>SET SCHEMA</> variants,
- which are <productname>PostgreSQL</productname> extensions.
+ standard, except for the <literal>OWNER</>, <literal>SET SCHEMA</> and
+ <literal>VALIDATE CONSTRAINT</> variants, which are
+ <productname>PostgreSQL</productname> extensions. The <literal>NOT VALID</>
+ clause of the <literal>ADD CONSTRAINT</> variant is also a
+ <productname>PostgreSQL</productname> extension.
</para>
</refsect1>