Re: BUG #18295: In PostgreSQL a unique index on targeted columns is sufficient to support a foreign key

David Rowley <dgrowleyml@gmail.com>

From: David Rowley <dgrowleyml@gmail.com>
To: Laurenz Albe <laurenz.albe@cybertec.at>
Cc: gparc@free.fr, pgsql-bugs <pgsql-bugs@lists.postgresql.org>
Date: 2024-01-26T13:19:13Z
Lists: pgsql-bugs
On Sat, 27 Jan 2024 at 01:14, Laurenz Albe <laurenz.albe@cybertec.at> wrote:
> Attached is a modified patch.

I think it looks mostly fine.

I'd only adjust the following addition to be a new paragraph:

-   <title>Foreign-Key Constraint Actions</title>
+   <title>Foreign-Key Constraints</title>

    <para>
     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.
+    It is also a <productname>PostgreSQL</productname> extension that a
+    foreign key constraint may reference a unique index instead of a
+    primary key or unique constraint.
    </para>

and drop the "also" at the same time.

I also noticed that, generally, we're not that consistent if we spell
it "foreign-key" or "foreign key".  You're introducing "foreign key"
in a location where there are a couple of "foreign-key"s. Maybe it's
better to be consistent in at least that location?

David



Commits

  1. Doc: mention foreign keys can reference unique indexes