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

From Isaac Morland
Subject Re: Foreign key joins revisited
Date
Msg-id CAMsGm5c3dkH8wzSgkvycPbXsxrxAVosc4LNh-mMg_C1Rt=Bg7A@mail.gmail.com
Whole thread Raw
In response to Re: Foreign key joins revisited  ("Joel Jacobson" <joel@compiler.org>)
Responses Re: Foreign key joins revisited  ("Joel Jacobson" <joel@compiler.org>)
Re: Foreign key joins revisited  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
On Mon, 27 Dec 2021 at 03:22, Joel Jacobson <joel@compiler.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. 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.

pgsql-hackers by date:

Previous
From: Bharath Rupireddy
Date:
Subject: Re: Is there a way (except from server logs) to know the kind of on-going/last checkpoint?
Next
From: Tom Lane
Date:
Subject: Re: Add Boolean node