Re: Foreign key joins revisited

From: Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>
To: Joel Jacobson <joel(at)compiler(dot)org>
Cc: Isaac Morland <isaac(dot)morland(at)gmail(dot)com>, 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-28 19:56:55
Message-ID: 202112281956.unllyb3s72m7@alvherre.pgsql
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 2021-Dec-27, Joel Jacobson wrote:

> >On Mon, Dec 27, 2021, at 15:48, Isaac Morland wrote:
> >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. For that matter, a join mentioning column names can break if the columns are changed. But
> >breakage where the query no longer compiles are better than ones where it suddenly means something very different so
> >overall I wouldn't worry about this too much.
>
> Yes, my proposal was indeed to give the FK constraint name.
> I just commented on Corey's different proposal that instead specified FK columns.

By way of precedent we have the ON CONFLICT clause, for which you can
specify a constraint name or a list of columns.

--
Álvaro Herrera 39°49'30"S 73°17'W — https://www.EnterpriseDB.com/
"Los trabajadores menos efectivos son sistematicamente llevados al lugar
donde pueden hacer el menor daño posible: gerencia." (El principio Dilbert)

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2021-12-28 20:10:57 Re: Foreign key joins revisited
Previous Message Tom Lane 2021-12-28 19:53:14 Re: [PROPOSAL] Make PSQLVAR on \getenv opitional