pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Larry Rosenman <ler@lerctr.org>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: pgsql-sql@postgresql.org
Cc: mail@garv.in
Subject: Re: Query issue/8.0.1/Serendipity
Date: Tue, 8 Mar 2005 09:41:28 -0600
Message-ID: <200503080941.28911.ler@lerctr.org> (raw)
In-Reply-To: <6329.1110296271@sss.pgh.pa.us>
References: <200503080548.17179.ler@lerctr.org>
	<6329.1110296271@sss.pgh.pa.us>

On Tuesday 08 March 2005 09:37 am, Tom Lane wrote:
> Larry Rosenman <ler@lerctr.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@lerctr.org
US Mail: 3535 Gaspar Drive, Dallas, TX 75220-3611



view thread (12+ messages)  latest in thread

Message-ID: <200503080941.28911.ler@lerctr.org>
Permalink:  ../200503080941.28911.ler@lerctr.org/
Also on:    postgresql.org/message-id/200503080941.28911.ler@lerctr.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: ler@lerctr.org, tgl@sss.pgh.pa.us, mail@garv.in
  Subject: Re: Query issue/8.0.1/Serendipity
  In-Reply-To: <200503080941.28911.ler@lerctr.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox