Re: Key joins

From: Matthias van de Meent <boekewurm+postgres(at)gmail(dot)com>
To: Joel Jacobson <joel(at)compiler(dot)org>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>, Arne Roland <arne(dot)roland(at)malkut(dot)net>, Anders Granlund <anders(dot)granlund(dot)0(at)gmail(dot)com>, Andreas Karlsson <andreas(at)proxel(dot)se>, Vik Fearing <vik(at)chouppes(dot)com>
Subject: Re: Key joins
Date: 2026-05-29 12:04:00
Message-ID: CAEze2WiLaz-uu8uD3xi3Cwvip+b4C7Y7Rdj=yx=vmJP+8poGTQ@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, 28 May 2026 at 20:48, Joel Jacobson <joel(at)compiler(dot)org> wrote:
>
> Hi hackers,
>
> This patch implements a new SQL language feature, that we intent to
> submit as a Change Proposal to the WG 3 SQL committee for the next
> meeting in Stockholm in June. We would greatly appreciate any feedback
> from the community.
>
> Web demo
> --------
>
> The attached Discussion paper has also been published at https://keyjoin.org
> with all examples in the paper runnable in the browser using a patched PGLite.

Re: "8.4 Why Column Lists Instead of Constraint Names" [0]

It's mentioned that the use of named foreign key constraints as key
column list definitions is not part of the proposal because they are
not universally applicable. While I do understand that for some cases
(multiple mentions of the same target table, CTEs, subqueries, ...)
there won't be a (uniquely) named constraint to reference, in many
(possibly most) cases the FK constraint name _will_ uniquely identify
the base table pair to join, and I think that using the FK name should
be supported as a major QoL addition in this proposal.

Note that the FOR KEY (cols) -> alias (cols) is still useful for the
reasons why constraint names can't always be used, but it's probably
not something I'd ever try to use unless I really, really needed the
specific guarantees granted by the new processing while I was writing
the query. `FOR KEY (something) -> something (something)` just doesn't
feel natural to me.

Kind regards,

Matthias van de Meent
Databricks (https://www.databricks.com)

[0]: https://keyjoin.org/#sec8.4

In response to

  • Key joins at 2026-05-28 18:47:50 from Joel Jacobson

Browse pgsql-hackers by date

  From Date Subject
Next Message Jakob Egger 2026-05-29 12:26:59 glob support in extension_control_path/dynamic_library_path?
Previous Message Shlok Kyal 2026-05-29 11:59:11 Re: Support EXCEPT for ALL SEQUENCES publications