Re: Idea: Avoid JOINs by using path expressions to follow FKs - Mailing list pgsql-hackers

From Andrew Dunstan
Subject Re: Idea: Avoid JOINs by using path expressions to follow FKs
Date
Msg-id bfe7134b-f3c4-3195-7c01-55f78a9ae092@dunslane.net
Whole thread Raw
In response to Re: Idea: Avoid JOINs by using path expressions to follow FKs  (Alvaro Herrera <alvherre@alvh.no-ip.org>)
Responses Re: Idea: Avoid JOINs by using path expressions to follow FKs  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
On 3/27/21 5:11 PM, Alvaro Herrera wrote:
> On 2021-Mar-27, Joel Jacobson wrote:
>
>> If there would be multiple foreign keys on a column we try to follow,
>> the query planner would throw an error forcing the user to use explicit joins instead.
> This seems pretty dangerous -- you just have to create one more FK, and
> suddenly a query that worked perfectly fine, now starts throwing errors
> because it's now ambiguous.  Feels a bit like JOIN NATURAL, which many
> people discourage because of this problem.
>


Maybe. I don't recall ever having seen a column with more than one FK.
Is that a common thing? In itself it seems like a bad idea.

Not saying I think this suggestion is a good idea, though. We've seen
many frameworks that hide joins, and the results are ... less than
universally good. If your application programmers don't like using
joins, then either a) you should have the DBA create some views for them
that contain the joins, or b) you have the wrong application programmers -:)


cheers


andrew

--
Andrew Dunstan
EDB: https://www.enterprisedb.com




pgsql-hackers by date:

Previous
From: Julien Rouhaud
Date:
Subject: Re: [PATCH] Hooks at XactCommand level
Next
From: Andrew Dunstan
Date:
Subject: Re: invalid data in file backup_label problem on windows