summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Paquier2018-09-21 06:03:37 +0000
committerMichael Paquier2018-09-21 06:03:37 +0000
commitce9cf8e7e6c436e13a729e2369c2c7ca1eae064d (patch)
treefeb9bd016d6c4fccf1b18d8ea37d0570ac0d05ed
parentbd1463e348fcf3a6e832092ccdeaecda2db9c117 (diff)
Document lock taken on referenced table when adding a foreign key
This can happen for CREATE TABLE and ALTER TABLE, so a mention is added to both of them in the concerned subsections. Author: Adrien Nayrat Discussion: https://postgr.es/m/[email protected]
-rw-r--r--doc/src/sgml/ref/alter_table.sgml5
-rw-r--r--doc/src/sgml/ref/create_table.sgml4
2 files changed, 8 insertions, 1 deletions
diff --git a/doc/src/sgml/ref/alter_table.sgml b/doc/src/sgml/ref/alter_table.sgml
index ec6b4c3311..f13a6cd944 100644
--- a/doc/src/sgml/ref/alter_table.sgml
+++ b/doc/src/sgml/ref/alter_table.sgml
@@ -373,6 +373,11 @@ WITH ( MODULUS <replaceable class="parameter">numeric_literal</replaceable>, REM
</para>
<para>
+ The addition of a foreign key constraint requires a
+ <literal>SHARE ROW EXCLUSIVE</literal> lock on the referenced table.
+ </para>
+
+ <para>
Additional restrictions apply when unique or primary key constraints
are added to partitioned tables; see <xref linkend="sql-createtable" />.
</para>
diff --git a/doc/src/sgml/ref/create_table.sgml b/doc/src/sgml/ref/create_table.sgml
index 5a19f94ce9..10428f8ff0 100644
--- a/doc/src/sgml/ref/create_table.sgml
+++ b/doc/src/sgml/ref/create_table.sgml
@@ -992,7 +992,9 @@ WITH ( MODULUS <replaceable class="parameter">numeric_literal</replaceable>, REM
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).
+ (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
tables and permanent tables. Also note that while it is possible to
define a foreign key on a partitioned table, it is not possible to