Skip to content

Commit

Permalink
Support foreign keys that reference partitioned tables
Browse files Browse the repository at this point in the history
Previously, while primary keys could be made on partitioned tables, it
was not possible to define foreign keys that reference those primary
keys.  Now it is possible to do that.

Author: Álvaro Herrera
Reviewed-by: Amit Langote, Jesper Pedersen
Discussion: https://postgr.es/m/[email protected]
  • Loading branch information
alvherre committed Apr 3, 2019
1 parent 9155580 commit f56f8f8
Show file tree
Hide file tree
Showing 15 changed files with 2,039 additions and 431 deletions.
7 changes: 1 addition & 6 deletions doc/src/sgml/ref/create_table.sgml
Original file line number Diff line number Diff line change
Expand Up @@ -379,9 +379,6 @@ WITH ( MODULUS <replaceable class="parameter">numeric_literal</replaceable>, REM
<para>
Partitioned tables do not support <literal>EXCLUDE</literal> constraints;
however, you can define these constraints on individual partitions.
Also, while it's possible to define <literal>PRIMARY KEY</literal>
constraints on partitioned tables, creating foreign keys that
reference a partitioned table is not yet supported.
</para>

<para>
Expand Down Expand Up @@ -1028,9 +1025,7 @@ WITH ( MODULUS <replaceable class="parameter">numeric_literal</replaceable>, REM
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
declare a foreign key that references a partitioned table.
tables and permanent tables.
</para>

<para>
Expand Down
Loading

0 comments on commit f56f8f8

Please sign in to comment.