Re: Foreign key joins revisited

From: "Joel Jacobson" <joel(at)compiler(dot)org>
To: pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: Foreign key joins revisited
Date: 2021-12-26 21:51:30
Message-ID: 8a0662d7-08d9-40fd-bb3e-c4fa5509a301@www.fastmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Corey Huinker 2021-12-26 22:25:05 Re: Foreign key joins revisited
Previous Message Sascha Kuhl 2021-12-26 21:39:45 Re: Foreign key joins revisited