From: | Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at> |
---|---|
To: | David Rowley <dgrowleyml(at)gmail(dot)com> |
Cc: | gparc(at)free(dot)fr, pgsql-bugs <pgsql-bugs(at)lists(dot)postgresql(dot)org> |
Subject: | Re: BUG #18295: In PostgreSQL a unique index on targeted columns is sufficient to support a foreign key |
Date: | 2024-01-26 12:14:06 |
Message-ID: | 763b0bc3828415afa5f815753100722611faa1e9.camel@cybertec.at |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs |
On Sat, 2024-01-27 at 00:33 +1300, David Rowley wrote:
> On Fri, 26 Jan 2024 at 23:55, Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at> wrote:
> > Attached is my suggested patch.
>
> Why did you choose to remove the mention of primary key and unique
> constraints in:
>
> - 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:
>
> - unique or primary key constraint in the referenced table. The user
> + unique or primary key constraint or a unique index in the
>
> 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.
I removed the mention of constraints for simplicity, but I agree that the
documentation should encourage users to reference constraints.
Attached is a modified patch.
Yours,
Laurenz Albe
Attachment | Content-Type | Size |
---|---|---|
v2-0001-Doc-foreign-keys-can-reference-unique-indexes.patch | text/x-patch | 3.8 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | PG Bug reporting form | 2024-01-26 13:06:03 | BUG #18313: No error triggered when subtracting an interval from a timestamp |
Previous Message | David Rowley | 2024-01-26 12:02:29 | Re: BUG #18305: Unexpected error: "WindowFunc not found in subplan target lists" triggered by subqueries |