Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1WFq8u-0001Xj-6V for pgsql-bugs@arkaria.postgresql.org; Tue, 18 Feb 2014 19:15:44 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1WFq8t-00007o-GD for pgsql-bugs@arkaria.postgresql.org; Tue, 18 Feb 2014 19:15:43 +0000 Received: from makus.postgresql.org ([2001:4800:7903:4::125]) by malur.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1WFq8s-00007f-Oy for pgsql-bugs@postgresql.org; Tue, 18 Feb 2014 19:15:42 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1WFq8m-0004iS-89 for pgsql-bugs@postgresql.org; Tue, 18 Feb 2014 19:15:42 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id s1IJFYrh009156; Tue, 18 Feb 2014 14:15:34 -0500 From: Tom Lane To: Joshua Yanovski cc: pgsql-bugs@postgresql.org Subject: Re: BUG #9227: Error on SELECT ROW OVERLAPS ROW with single ROW argument In-reply-to: References: <20140215035549.24618.37927@wrigleys.postgresql.org> <10303.1392683593@sss.pgh.pa.us> <7547.1392745766@sss.pgh.pa.us> <7822.1392746510@sss.pgh.pa.us> <8502.1392748781@sss.pgh.pa.us> Comments: In-reply-to Joshua Yanovski message dated "Tue, 18 Feb 2014 10:50:26 -0800" Date: Tue, 18 Feb 2014 14:15:34 -0500 Message-ID: <9155.1392750934@sss.pgh.pa.us> X-Pg-Spam-Score: -2.5 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-bugs Precedence: bulk Sender: pgsql-bugs-owner@postgresql.org Joshua Yanovski writes: > That sounds like it should work. I was also wondering whether it > might be possible to do this more generally with some kind of "let" > internal node: > (let var = x in (var >= y and var <= z) > I don't know enough about the planner or the SQL standard to know > whether this would work, but it does seem a little nicer than > special-casing BETWEEN to me. Hmm ... interesting idea, but I don't think it answers any of the fundamental issues about comparison semantics (ie, how much do we care if "var" is promoted differently in the two clauses). Also, as a grammar translation target for BETWEEN it would be a pretty bad choice, because now views that had been defined in a perfectly SQL-compliant manner would print out with very-PG-specific syntax. The existing translation is nasty because of the double eval issue, but at least what we print is standard SQL. regards, tom lane -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs