Re: Foreign key joins revisited

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Isaac Morland <isaac(dot)morland(at)gmail(dot)com>
Cc: Joel Jacobson <joel(at)compiler(dot)org>, Corey Huinker <corey(dot)huinker(at)gmail(dot)com>, PostgreSQL Developers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Foreign key joins revisited
Date: 2021-12-27 18:15:45
Message-ID: 1516614.1640628945@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Isaac Morland <isaac(dot)morland(at)gmail(dot)com> writes:
> On Mon, 27 Dec 2021 at 03:22, Joel Jacobson <joel(at)compiler(dot)org> wrote:
>> However, I see one problem with leaving out the key columns:
>> First, there is only one FK in permission pointing to role, and we write a
>> query leaving out the key columns.
>> Then, another different FK in permission pointing to role is later added,
>> and our old query is suddenly in trouble.

> I thought the proposal was to give the FK constraint name. However, if the
> idea now is to allow leaving that out also if there is only one FK, then
> that's also OK as long as people understand it can break in the same way
> NATURAL JOIN can break when columns are added later.

NATURAL JOIN is widely regarded as a foot-gun that the SQL committee
should never have invented. Why would we want to create another one?

(I suspect that making the constraint name optional would be problematic
for reasons of syntax ambiguity, anyway.)

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Alvaro Herrera 2021-12-27 18:31:46 Re: Column Filtering in Logical Replication
Previous Message Justin Pryzby 2021-12-27 17:59:25 Re: Add index scan progress to pg_stat_progress_vacuum