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 D834052969 for ; Mon, 15 Aug 2005 23:20:38 -0300 (ADT) 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 07680-08 for ; Tue, 16 Aug 2005 02:20:35 +0000 (GMT) Received: from zproxy.gmail.com (zproxy.gmail.com [64.233.162.202]) by svr1.postgresql.org (Postfix) with ESMTP id 6A23752928 for ; Mon, 15 Aug 2005 23:20:31 -0300 (ADT) Received: by zproxy.gmail.com with SMTP id z6so750875nzd for ; Mon, 15 Aug 2005 19:20:35 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=YKsVZHRkVO0bdeMTF2La1yiUdVkJDYQCEwexTqBRnYaJHCM+Ttof9vTRlkpuUMz7KhYw/k/A0iUUwheQIFG5vf33aGdRRXreX/ziWeRxgyDtDYFtZdSz8Lh+EfQ+W6uAw84lasyeLZpXF1irMirj7uOfkai+Yht7yINlT6UE/1o= Received: by 10.36.129.8 with SMTP id b8mr5754551nzd; Mon, 15 Aug 2005 19:20:35 -0700 (PDT) Received: by 10.36.224.9 with HTTP; Mon, 15 Aug 2005 19:20:35 -0700 (PDT) Message-ID: <3d104d6f0508151920fcc8a03@mail.gmail.com> Date: Mon, 15 Aug 2005 21:20:35 -0500 From: Dario Bahena Tapia To: Tom Lane Subject: Re: Parentheses in FROM clause and evaluation order. Cc: Stephan Szabo , pgsql-sql@postgresql.org In-Reply-To: <20489.1124157760@sss.pgh.pa.us> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline References: <200508110042.j7B0g1TZ015835@panselmo.fciencias.unam.mx> <20050815065906.K33261@megazone.bigpanda.com> <3d104d6f05081509345067d83b@mail.gmail.com> <20050815183859.U67925@megazone.bigpanda.com> <20489.1124157760@sss.pgh.pa.us> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.024 required=5 tests=[RCVD_BY_IP=0.024] X-Spam-Level: X-Archive-Number: 200508/158 X-Sequence-Number: 22386 Ok, thanks for the responses guys. Then, in the case where the final result is the same, could we think the parentheses in the FROM clause, as a tool to clarify the query to the user? Since in the end, this order could be changed by the implementation for performance reasons. salu2 dario estepario ... 2005/8/15, Tom Lane : > Stephan Szabo writes: > > On Mon, 15 Aug 2005, Dario Bahena Tapia wrote: > >> The final result seems to be the same, I just was curious about the > >> standard behavior. Does the SQl says something about this execution > >> order? >=20 > > I believe SQL defines the order to pay attention to parens, so A join (= B > > join C) style clauses result in a "table" being derived from B join C a= nd > > another from A joined with that table. >=20 > SQL only constrains the results, though. It does not forbid the > implementation from doing the work in whatever way seems best to it, > so long as the results are the same (and "same" does not consider > row ordering). >=20 > For example, SQL92 3.3.4.4 says >=20 > A conforming implementation is not required to perform the exact > sequence of actions defined in the General Rules, but shall achi= eve > the same effect on SQL-data and schemas as that sequence. >=20 >=20 > regards, tom lane >