| From: | "Joel Jacobson" <joel(at)compiler(dot)org> |
|---|---|
| To: | "Laurenz Albe" <laurenz(dot)albe(at)cybertec(dot)at>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org> |
| Cc: | "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 13:21:08 |
| Message-ID: | 2ac20bea-4130-4cf3-8e13-ea7c6d062296@app.fastmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
On Fri, May 29, 2026, at 14:51, Laurenz Albe wrote:
> On Thu, 2026-05-28 at 20:47 +0200, Joel Jacobson wrote:
>> 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.
>
> Your presentation at the pgconf.dev really convinced me that this is
> a useful feature.
Thanks for the opportunity of presenting.
> I had only one consideration:
>
>> FROM orders o
>> LEFT JOIN order_items oi FOR KEY (order_id) -> o (id)
>
> In the spirit of looking more like SQL, how about replacing the
> arrows with FROM and TO?
>
> Either
>
> a JOIN b FOR KEY (col1) TO (col2)
>
> or, slightly more verbose and natural language-like:
>
> a JOIN b FOR KEY FROM (col1) TO (col2)
>
> And if the arrow points the other way,
>
> a JOIN b FOR KEY (col1) FROM (col2)
>
> or
>
> a JOIN b FOR KEY TO (col1) FROM (col2)
We actually originally considered TO and FROM as keywords for indicating
direction, but FROM in a join clause causes confusion with the FROM
clause itself. Our user discussions over the last three years indicates
that arrows are clearer and less ambiguous.
It's also worth to mention that SQL/PGQ also uses ASCII arrows to
indicate direction for its graph pattern syntax [1].
[1] https://peter.eisentraut.org/blog/2023/04/04/sql-2023-is-finished-here-is-whats-new
/Joel
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Jakub Wartak | 2026-05-29 13:22:50 | Re: Heads Up: cirrus-ci is shutting down June 1st |
| Previous Message | Laurenz Albe | 2026-05-29 12:51:23 | Re: Key joins |