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

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.

(Is this on the mysql gotchas page?)

			regards, tom lane



view thread (12+ messages)  latest in thread

Message-ID: <6329.1110296271@sss.pgh.pa.us>
Permalink:  ../6329.1110296271@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/6329.1110296271@sss.pgh.pa.us

 · 

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: tgl@sss.pgh.pa.us, ler@lerctr.org
  Subject: Re: Query issue/8.0.1/Serendipity
  In-Reply-To: <6329.1110296271@sss.pgh.pa.us>

* 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