aboutsummaryrefslogtreecommitdiff
path: root/doc/src
diff options
context:
space:
mode:
Diffstat (limited to 'doc/src')
-rw-r--r--doc/src/sgml/ddl.sgml20
-rw-r--r--doc/src/sgml/ref/create_table.sgml19
2 files changed, 23 insertions, 16 deletions
diff --git a/doc/src/sgml/ddl.sgml b/doc/src/sgml/ddl.sgml
index 440a899d122..11fa9c4a327 100644
--- a/doc/src/sgml/ddl.sgml
+++ b/doc/src/sgml/ddl.sgml
@@ -1181,16 +1181,16 @@ CREATE TABLE posts (
<para>
A foreign key must reference columns that either are a primary key or
- form a unique constraint. This means that the referenced columns always
- have an index (the one underlying the primary key or unique constraint);
- so checks on whether a referencing row has a match will be efficient.
- Since a <command>DELETE</command> of a row from the referenced table
- or an <command>UPDATE</command> of a referenced column will require
- a scan of the referencing table for rows matching the old value, it
- is often a good idea to index the referencing columns too. Because this
- is not always needed, and there are many choices available on how
- to index, declaration of a foreign key constraint does not
- automatically create an index on the referencing columns.
+ form a unique constraint, or are columns from a non-partial unique index.
+ This means that the referenced columns always have an index to allow
+ efficient lookups on whether a referencing row has a match. Since a
+ <command>DELETE</command> of a row from the referenced table or an
+ <command>UPDATE</command> of a referenced column will require a scan of
+ the referencing table for rows matching the old value, it is often a good
+ idea to index the referencing columns too. Because this is not always
+ needed, and there are many choices available on how to index, the
+ declaration of a foreign key constraint does not automatically create an
+ index on the referencing columns.
</para>
<para>
diff --git a/doc/src/sgml/ref/create_table.sgml b/doc/src/sgml/ref/create_table.sgml
index 10ef699fab9..6a15676d882 100644
--- a/doc/src/sgml/ref/create_table.sgml
+++ b/doc/src/sgml/ref/create_table.sgml
@@ -1137,10 +1137,11 @@ WITH ( MODULUS <replaceable class="parameter">numeric_literal</replaceable>, REM
column(s) of some row of the referenced table. If the <replaceable
class="parameter">refcolumn</replaceable> list is omitted, the
primary key of the <replaceable class="parameter">reftable</replaceable>
- is used. The referenced columns must be the columns of a non-deferrable
- unique or primary key constraint in the referenced table. The user
- must have <literal>REFERENCES</literal> permission on the referenced table
- (either the whole table, or the specific referenced columns). The
+ is used. Otherwise, the <replaceable class="parameter">refcolumn</replaceable>
+ list must refer to the columns of a non-deferrable unique or primary key
+ constraint or be the columns of a non-partial unique index. The user
+ must have <literal>REFERENCES</literal> permission on the referenced
+ table (either the whole table, or the specific referenced columns). The
addition of a foreign key constraint requires a
<literal>SHARE ROW EXCLUSIVE</literal> lock on the referenced table.
Note that foreign key constraints cannot be defined between temporary
@@ -2277,13 +2278,19 @@ CREATE TABLE cities_partdef
</refsect2>
<refsect2>
- <title>Foreign-Key Constraint Actions</title>
+ <title>Foreign Key Constraints</title>
<para>
- The ability to specify column lists in the foreign-key actions
+ The ability to specify column lists in the foreign key actions
<literal>SET DEFAULT</literal> and <literal>SET NULL</literal> is a
<productname>PostgreSQL</productname> extension.
</para>
+
+ <para>
+ It is a <productname>PostgreSQL</productname> extension that a
+ foreign key constraint may reference columns of a unique index instead of
+ columns of a primary key or unique constraint.
+ </para>
</refsect2>
<refsect2>