Re: Left join syntax error

Поиск
Список
Период
Сортировка
От Erik Wienhold
Тема Re: Left join syntax error
Дата
Msg-id 5150aba7-b6e4-4c40-a357-9dd7528ec870@ewie.name
обсуждение исходный текст
Ответ на Re: Left join syntax error  ("David G. Johnston" <david.g.johnston@gmail.com>)
Список 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



В списке pgsql-general по дате отправления:

Предыдущее
От: "David G. Johnston"
Дата:
Сообщение: Re: Left join syntax error
Следующее
От: Rich Shepard
Дата:
Сообщение: Re: Left join syntax error