X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 32D8856403 for ; Tue, 8 Mar 2005 15:41:30 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 07526-03 for ; Tue, 8 Mar 2005 15:41:28 +0000 (GMT) Received: from lerami.lerctr.org (lerami.lerctr.org [192.147.25.11]) by svr1.postgresql.org (Postfix) with ESMTP id A6EBA56378 for ; Tue, 8 Mar 2005 15:41:25 +0000 (GMT) Received: from lerlaptop.lerctr.org ([192.147.25.14]) by lerami.lerctr.org with esmtpsa (TLSv1:RC4-MD5:128) (Exim 4.50) id 1D8gpt-0001cF-NE; Tue, 08 Mar 2005 09:41:30 -0600 From: Larry Rosenman Organization: LERCTR Consulting To: Tom Lane Subject: Re: Query issue/8.0.1/Serendipity Date: Tue, 8 Mar 2005 09:41:28 -0600 User-Agent: KMail/1.7.1 Cc: pgsql-sql@postgresql.org, mail@garv.in References: <200503080548.17179.ler@lerctr.org> <6329.1110296271@sss.pgh.pa.us> In-Reply-To: <6329.1110296271@sss.pgh.pa.us> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200503080941.28911.ler@lerctr.org> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.005 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200503/133 X-Sequence-Number: 20612 On Tuesday 08 March 2005 09:37 am, Tom Lane wrote: > Larry Rosenman 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