On Fri, 26 Jan 2024 at 23:55, Laurenz Albe <laurenz.albe@cybertec.at> wrote:
> Attached is my suggested patch.
Why did you choose to remove the mention of primary key and unique
constraints in:
+++ b/doc/src/sgml/ddl.sgml
@@ -1317,9 +1317,7 @@ CREATE TABLE posts (
</para>
<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);
+ A foreign key must reference columns on which a unique index in defined,
but choose to keep them here:
+++ b/doc/src/sgml/ref/create_table.sgml
@@ -1166,7 +1166,7 @@ WITH ( MODULUS <replaceable
class="parameter">numeric_literal</replaceable>, REM
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
+ unique or primary key constraint or a unique index in the
referenced table. The user
I'd rather we continue to mention primary keys and unique constraints
in ddl.sgml. It just seems good practice to me to define a constraint
and it seems better if people continue to do that to increase the
likelihood that their schema is compatible with another RDBMS.
David