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

From Joel Jacobson
Subject Re: Foreign key joins revisited
Date
Msg-id 8a0662d7-08d9-40fd-bb3e-c4fa5509a301@www.fastmail.com
Whole thread Raw
In response to Re: Foreign key joins revisited  ("Joel Jacobson" <joel@compiler.org>)
Responses Re: Foreign key joins revisited
List pgsql-hackers
On Sun, Dec 26, 2021, at 22:38, Joel Jacobson wrote:
> FROM permission p
>   LEFT JOIN ON KEY p.role r
>   LEFT JOIN team_role tr ON KEY role TO r
>   LEFT JOIN ON KEY tr.team t
>   LEFT JOIN user_role ur ON KEY role TO r
>   LEFT JOIN ON KEY ur.user u

Hm, might be problematic to reuse dot operator, I think it would be controversial.

Perhaps this would be more SQL idiomatic:

FROM permission p
   LEFT JOIN ON KEY role IN p AS r
   LEFT JOIN team_role AS tr ON KEY role TO r
   LEFT JOIN ON KEY team IN tr AS t
   LEFT JOIN user_role AS ur ON KEY role TO r
   LEFT JOIN ON KEY user IN ur AS u

/Joel

pgsql-hackers by date:

Previous
From: Sascha Kuhl
Date:
Subject: Re: Foreign key joins revisited
Next
From: Corey Huinker
Date:
Subject: Re: Foreign key joins revisited