Re: Foreign key joins revisited - Mailing list pgsql-hackers

From Joel Jacobson
Subject Re: Foreign key joins revisited
Date
Msg-id 1ff9d756-f1f1-4048-af80-2098501f5a59@www.fastmail.com
Whole thread Raw
In response to Re: Foreign key joins revisited  (Isaac Morland <isaac.morland@gmail.com>)
List pgsql-hackers
On Mon, Dec 27, 2021, at 17:03, Isaac Morland wrote:
> On Mon, 27 Dec 2021 at 10:20, Joel Jacobson <joel@compiler.org> wrote:

> Foreign key constraint names have been given the same names as the referenced tables.
>
> While I agree this could be a simple approach in many real cases for having easy to understand FK constraint names, I
> wonder if for illustration and explaining the feature if it might work better to use names that are completely unique so that
> it's crystal clear that the names are constraint names, not table names.

Good point, I agree. New version below:

FROM permission p
LEFT JOIN KEY p.permission_role_id_fkey r
LEFT JOIN team_role tr KEY team_role_role_id_fkey REF r
LEFT JOIN KEY tr.team_role_team_id_fkey t
LEFT JOIN user_role ur KEY user_role_role_id_fkey REF r
LEFT JOIN KEY ur.user_role_user_id_fkey u
WHERE p.id = 1;

Thoughts?

/Joel

pgsql-hackers by date:

Previous
From: Pavel Stehule
Date:
Subject: Re: default to to ON_ERROR_STOP=on (Re: psql: exit status with multiple -c and -f)
Next
From: Alvaro Herrera
Date:
Subject: Re: Column Filtering in Logical Replication