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

From: "Thomas Peter" <usenet(at)braindumped(dot)com>
To: "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: change the order of FROM selection to make query work
Date: 2006-09-26 14:40:22
Message-ID: sZ2rFiAX.1159281622.9141730.sol00-thomas@sol00.hostsharing.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Am 26.9.2006 schrieb "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>:
>> 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.

ok, lesson learned.
thank you!

cheers,
thomas

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Brandon Aiken 2006-09-26 14:58:26 Re: serial column
Previous Message Tom Lane 2006-09-26 14:27:10 Re: Dead Lock problem with 8.1.3