Re: change the order of FROM selection to make query work

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: change the order of FROM selection to make query work
Дата
Msg-id 25383.1159280369@sss.pgh.pa.us
обсуждение исходный текст
Ответ на change the order of FROM selection to make query work  ("Thomas Peter" <usenet@braindumped.com>)
Ответы Re: change the order of FROM selection to make query work  ("Thomas Peter" <usenet@braindumped.com>)
Re: change the order of FROM selection to make query work  (Scott Marlowe <smarlowe@g2switchworks.com>)
Список pgsql-general
"Thomas Peter" <thomas@braindumped.com> writes:
> the full code that does produce the error (and this error can be resolved
> as in OP described) is:

Never oversimplify a bug report.

> FROM ticket as t, permission as perm, enum as p
> LEFT OUTER JOIN ticket_custom c ON (t.id = c.ticket AND c.name =
> 'fachabteilung')

The above is, plain and simple, wrong.  According to the SQL spec,
JOIN binds more tightly than comma in a FROM-list, so what you had was

FROM ..., (enum as p
  LEFT OUTER JOIN ticket_custom c ON (t.id = c.ticket AND c.name =
  'fachabteilung'))

which of course fails because only p and c are visible in the JOIN's
ON condition.  You fixed it by moving "t" to become part of the JOIN
structure.

I was aware that MySQL parses this sort of structure wrongly, but it's
disappointing to hear that sqlite does too :-(

            regards, tom lane

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

Предыдущее
От: Martijn van Oosterhout
Дата:
Сообщение: Re: Dead Lock problem with 8.1.3
Следующее
От: Alban Hertroys
Дата:
Сообщение: Re: Dead Lock problem with 8.1.3