Re: Query issue/8.0.1/Serendipity

From: Larry Rosenman <ler(at)lerctr(dot)org>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-sql(at)postgresql(dot)org, mail(at)garv(dot)in
Subject: Re: Query issue/8.0.1/Serendipity
Date: 2005-03-08 15:41:28
Message-ID: 200503080941.28911.ler@lerctr.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

On Tuesday 08 March 2005 09:37 am, Tom Lane wrote:
> Larry Rosenman <ler(at)lerctr(dot)org> writes:
> > I have an 8.0.1 server running the Blogging software serendipity, and the
> > following query fails with "relation e not defined", but it is on the
> > first line:
> >
> > "SELECT timestamp FROM serendipity_entries e, serendipity_category c,
> > serendipity_entrycat ec LEFT OUTER JOIN serendipity_entryproperties
> > ep_cache_extended ON (e.id = ep_cache_extended.entryid AND
> > ep_cache_extended.property = 'ep_cache_extended') ...
>
> Broken SQL that's only ever been tested on MySQL.
>
> Last I heard, MySQL treated this sort of construct as joining
> left-to-right, ie,
>
> FROM e CROSS JOIN c CROSS JOIN ec LEFT JOIN ...
>
> in which case the left argument of the LEFT JOIN already contains
> e, c, and ec so it's OK for the JOIN condition to use e. Unfortunately
> for MySQL users everywhere, this is expressly contrary to the SQL spec:
> per spec, JOIN binds more tightly than commas in the FROM-list do.

Thanks, Tom. Garvin Hicking (the Serendipity Developer) confirms it works on
MySQL, and I wasn't sure about the spec.

Thanks for confirming it's a MySQL gotcha :)

LER

>
> (Is this on the mysql gotchas page?)
>
> regards, tom lane

--
Larry Rosenman http://www.lerctr.org/~ler
Phone: +1 214-351-4152 E-Mail: ler(at)lerctr(dot)org
US Mail: 3535 Gaspar Drive, Dallas, TX 75220-3611

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Ian Barwick 2005-03-08 16:55:44 Re: Query issue/8.0.1/Serendipity
Previous Message Tom Lane 2005-03-08 15:37:51 Re: Query issue/8.0.1/Serendipity