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.94.2) (envelope-from ) id 1s8Lli-00ByaH-2F for pgsql-general@arkaria.postgresql.org; Sat, 18 May 2024 15:14:43 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1s8Lli-007cLt-4J for pgsql-general@arkaria.postgresql.org; Sat, 18 May 2024 15:14:42 +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.94.2) (envelope-from ) id 1s8Llh-007cLg-PV for pgsql-general@lists.postgresql.org; Sat, 18 May 2024 15:14:41 +0000 Received: from mout-u-107.mailbox.org ([80.241.59.207]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1s8Llf-000pl9-D1 for pgsql-general@lists.postgresql.org; Sat, 18 May 2024 15:14:40 +0000 Received: from smtp2.mailbox.org (smtp2.mailbox.org [10.196.197.2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-u-107.mailbox.org (Postfix) with ESMTPS id 4VhS6f0kgKz9sf6; Sat, 18 May 2024 17:14:34 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ewie.name; s=MBO0001; t=1716045274; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=QowJzrKhUISvn5DZ2TF5b5IP7JAsG9kgFmVk15kirJ4=; b=VtZ0FsL1H2fzAdbA/2qJeC+/Igwbmpi91+amGXTERSpovF2nEkk6T64y8rsQkvGL/UADhB UZ1COF+7MT4gaZleOj8G/4K7gKediR/Muhvrq7HgRoghkihVa2Pzb82Zq12zrsnCg8JXft ygLVE9d/uY5knM9QHVaZNDIyBeOYkI4S4VB3M9CokqDa7Stv9NsERQbT3a9pZSTYtyhXuo H/6Y1Xd176I13EA8QsFBycrwGPh2o0y5Xwh9ipaxZaSytzGcd8jSkYQQrjIaKNmEP1Wa4s X2tMtOY9oLr0yWQBVLdKSSvS9BFFCiTsKQkp6/QmkjS72w40nbHzC5bczmkvPw== Date: Sat, 18 May 2024 17:14:32 +0200 From: Erik Wienhold To: Shammat Cc: pgsql-general@lists.postgresql.org Subject: Re: Left join syntax error Message-ID: <4dde36a5-a22e-452a-b395-85ac7bd6bc05@ewie.name> References: <2c877258-61cc-dd2d-fac7-4f2a5c6293e7@appl-ecosys.com> <9d899286-3a73-4894-a6e0-eab529c92e65@gmx.net> <7d422a60-c581-485d-b5fd-4b2bb284b919@ewie.name> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <7d422a60-c581-485d-b5fd-4b2bb284b919@ewie.name> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk I wrote: > But I wonder if the implicit cross join syntax ("FROM peoples, companies") > should actually produce this error because the explicit cross join > works: > > SELECT p.lname, p.fname, p.job_title, p.company_nbr, p.email, c.company_name > FROM people as p > CROSS JOIN companies as c > LEFT JOIN companies ON c.company_nbr = p.company_nbr; On second thought it looks like that (companies as c LEFT JOIN companies) actually is the second FROM item. Adding parenthesis to the explicit cross join version gives the same error: SELECT p.lname, p.fname, p.job_title, p.company_nbr, p.email, c.company_name FROM people as p CROSS JOIN ( companies as c LEFT JOIN companies ON c.company_nbr = p.company_nbr ); So the comma in the FROM item list has lower precedence than the join operators. -- Erik