From: | Mark Jeffcoat <jeffcoat(at)alumni(dot)rice(dot)edu> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: Join condition parsing puzzle |
Date: | 2018-08-25 00:43:32 |
Message-ID: | CAOT_8kZJrtPDRvSJ41iLk+jKAyrZNssT-92w2gYD+7fsELqGTg@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On Thu, Aug 23, 2018 at 4:51 PM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>
> Mark Jeffcoat <jeffcoat(at)alumni(dot)rice(dot)edu> writes:
> > I would have claimed before seeing this example that it wasn't even
> > grammatical; I thought the only legal place to write the ON clause was
> > immediately after the JOIN. Apparently not.
>
> You read it as
>
> SELECT *
> FROM
> relation_a
> LEFT JOIN (relation_b
> JOIN relation_c
> ON (relation_c.id_p = relation_b.id_p))
> ON (relation_a.id_c = relation_b.id_c AND relation_a.id_v = relation_b.id_v);
>
> There's no other valid way to parenthesize it, so that's what
> the parser does.
Thank you very much for your help, Tom. In retrospect, I see I'd
over-generalized the rule that sub-selects in the from clause require
an alias.
Clear now.
--
Mark Jeffcoat
Austin, TX
From | Date | Subject | |
---|---|---|---|
Next Message | Tim Cross | 2018-08-25 02:42:15 | Re: unorthodox use of PG for a customer |
Previous Message | Dimitri Maziuk | 2018-08-24 19:54:57 | Re: unorthodox use of PG for a customer |