From: | Erik Wienhold <ewie(at)ewie(dot)name> |
---|---|
To: | "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com> |
Cc: | Shammat <shammat(at)gmx(dot)net>, "pgsql-general(at)lists(dot)postgresql(dot)org" <pgsql-general(at)lists(dot)postgresql(dot)org> |
Subject: | Re: Left join syntax error |
Date: | 2024-05-18 15:30:36 |
Message-ID: | 5150aba7-b6e4-4c40-a357-9dd7528ec870@ewie.name |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On 2024-05-18 17:12 +0200, David G. Johnston wrote:
> Too lazy to find the docs right now but what you are observing is basically
> an operator precedence effect. The comma join hasn’t happened at the time
> the left join is evaluated and so other tables in the comma join cannot
> appear in the on clause of the left join. Placing everything inside a
> single from slot and moving the conditions to the where clause removes
> changes the precedence aspect so that the cross join does indeed evaluate
> prior to the left join.
Thanks David. The docs on table expressions clarify the precedence:
https://www.postgresql.org/docs/16/queries-table-expressions.html#QUERIES-FROM
I'm using SQL for 17 years now and yet I still forget that joins are
table expressions m(
--
Erik
From | Date | Subject | |
---|---|---|---|
Next Message | Rich Shepard | 2024-05-18 15:38:46 | Re: Left join syntax error |
Previous Message | David G. Johnston | 2024-05-18 15:27:19 | Re: Left join syntax error |