Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1wSx9c-000Ddt-2f for pgsql-hackers@arkaria.postgresql.org; Fri, 29 May 2026 13:21:36 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1wSx9a-002brm-1U for pgsql-hackers@arkaria.postgresql.org; Fri, 29 May 2026 13:21:34 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1wSx9Z-002brd-2w for pgsql-hackers@lists.postgresql.org; Fri, 29 May 2026 13:21:34 +0000 Received: from fout-b1-smtp.messagingengine.com ([202.12.124.144]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1wSx9X-000000007lH-43RI for pgsql-hackers@postgresql.org; Fri, 29 May 2026 13:21:33 +0000 Received: from phl-compute-05.internal (phl-compute-05.internal [10.202.2.45]) by mailfout.stl.internal (Postfix) with ESMTP id 55EB41D000C5; Fri, 29 May 2026 09:21:31 -0400 (EDT) Received: from phl-imap-08 ([10.202.2.84]) by phl-compute-05.internal (MEProxy); Fri, 29 May 2026 09:21:31 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=compiler.org; h= cc:cc:content-transfer-encoding:content-type:content-type:date :date:from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to; s=fm3; t=1780060890; x=1780147290; bh=lszVzXtGMQp/d4S4hzuRHS6BXmmf9COXDy3Em+P4bp0=; b= hntWxCd9HufdCed/tLdRetcIu+TKGwn38VDtCMnGaPXcwa6NAD01mmyrm1k9zrUp 2WRL3anD6vfcjX/q3TIDrHYhblAkbPVwTO0iGrrmi9BpFhlv7umPM5RTLhdQk2Uu 4ASurpfFyS4Nq91FpdKu7bay7rqTZ/D3z91NInZK4VsHK0GsOf9669Nh3UnPQSDZ 2SH6464QMck0lMrjHplqWiZS49nyKhQXcmn5qTQ9kof566w1yfPk+NWi4qs/Y7Mm 8rdTBfh1jnXM0mJE2av9PBI+4a9o1sEHWBGCo/tgy4+z0o4Iemm2UwS1j7MnBKot D5i6fS7WwRBGlY7zmYccOQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm3; t=1780060890; x= 1780147290; bh=lszVzXtGMQp/d4S4hzuRHS6BXmmf9COXDy3Em+P4bp0=; b=k qkEgBv8SV5KLOPInYtVQ7EMxvt82zqgVqt6oRXYCjtK9FvWuB5vAHQ3TuQbJEGV+ SNVNHuF+prccZS4X6T3RV3lMGmmvPblxvjNXAs7RFw3q2Sl/KV9qpuSsLOCZ0lCj ZBV5/CZOG6FxI/cqrIHuds65+gOMlqeg9Y9MA2f+ozX643CrA3c1p5BBtQcn35+/ 00rL0MWZLw13afNSRzr6mu8UBZAB4dIjAen9CEU8in/DXaoIQwsAkaLg8/mIm9eq oAs2rmq6DhzWrJyOZZhcacaWfLZX75T7f8+1vvA+83biSkO9pfMLffuE5jFyfNgi 57cArqST4FDOyja+lHbxg== X-ME-Sender: X-ME-Proxy-Cause: dmFkZTFSQMBiTD1kAoN124RxG31hhMxMkvdO6FpX33UBjg8YUhT64BswmoRyMJla/IKJBk suHqdHFRA/PWKynPB4k9YPTW7UxDI+dz0Rg7Ue63D89W1T5mGq8na53Q07b90Twegjg63a hYcTiENyt+aN5ZbyAiC9guERrSldNvcBJdc+sekZkqHbnEe5wVw2Vpx40OhQTAEowco507 c2OSmmVC02RPF85hah0zEQt5aKCFKaJpS1SWsJtLB7VcgeWzfE3rhrC6JpJn8NYZGKdLD9 T4hvG0hVD0CXv/bA7UOYo9iK3pxZOwyC1acuSEOTR0AtVtNGbmcVXmnKseVePI/IUCkxbC XkDHPgyN88Ak/A0lNSJx3c2Eds8GvB2ECdAUi7/sVKpMoQJ3daoCKOI5Wr3DKvWl7yedJ/ hW3ssk0Cx3scJRKF5J+CjHY3Lh8H5IuLR34t16kQvWc8cJCoeFpLExIN8F8cdDPd3Q2c7L uPI6VggHFcjQ6t7gY7zv6z1/UrYOQXA5G/qJzDJnfHK9oFoYngtDd2lCzEYHKxHKYLOKLk L7hAvQgHAuXRknG2JpOXB0gTXCGr8R3o2qSE3jmjzDbCXA9WlqoI0hdCfGvkwRz0ArLZO5 0DQBo7d1RPvcexqUn3razrQInwDHNx55DWoSGJkLNCSdqfEwjhiR2QBvxIfQ X-ME-Proxy: Feedback-ID: ic6394509:Fastmail Received: by mailuser.phl.internal (Postfix, from userid 501) id 34E7E2CE0412; Fri, 29 May 2026 09:21:30 -0400 (EDT) X-Mailer: MessagingEngine.com Webmail Interface MIME-Version: 1.0 X-ThreadId: AN_Vy_h1VtK3 Date: Fri, 29 May 2026 15:21:08 +0200 From: "Joel Jacobson" To: "Laurenz Albe" , pgsql-hackers Cc: "Arne Roland" , "Anders Granlund" , "Andreas Karlsson" , "Vik Fearing" Message-Id: <2ac20bea-4130-4cf3-8e13-ea7c6d062296@app.fastmail.com> In-Reply-To: <264e69aed5a2fdd93ad555dff96daeabc5c35724.camel@cybertec.at> References: <00c30670-64e1-4c30-a349-784426d333df@app.fastmail.com> <264e69aed5a2fdd93ad555dff96daeabc5c35724.camel@cybertec.at> Subject: Re: Key joins Content-Type: text/plain Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk 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