Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1Ystxq-0000YV-AF for pgsql-bugs@arkaria.postgresql.org; Thu, 14 May 2015 14:18:18 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1Ystxp-0005u7-52 for pgsql-bugs@arkaria.postgresql.org; Thu, 14 May 2015 14:18:17 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1YssPl-0000Hj-13 for pgsql-bugs@postgresql.org; Thu, 14 May 2015 12:39:01 +0000 Received: from formauri.es ([78.47.205.180]) by magus.postgresql.org with esmtp (Exim 4.84) (envelope-from ) id 1YssPg-00064O-Le for pgsql-bugs@postgresql.org; Thu, 14 May 2015 12:38:58 +0000 Received: from [0.0.0.0] (formauri.es [78.47.205.180]) by formauri.es (Postfix) with ESMTPS id 37E4383469; Thu, 14 May 2015 14:38:53 +0200 (CEST) Message-ID: <5554975C.9060608@personal.formauri.es> Date: Thu, 14 May 2015 14:38:52 +0200 From: Pedro Gimeno User-Agent: Mozilla/5.0 (X11; Linux i686; rv:24.0) Gecko/20100101 Icedove/24.7.0 MIME-Version: 1.0 To: Tom Lane , Josh Berkus CC: pgsql-bugs@postgresql.org Subject: Re: Prepare/Execute silently discards prohibited ORDER BY values References: <555143EC.1000808@agliodbs.com> <432.1431389890@sss.pgh.pa.us> <55514883.4000106@agliodbs.com> <5168.1431401736@sss.pgh.pa.us> <5553F24B.8070009@agliodbs.com> <13099.1431565504@sss.pgh.pa.us> In-Reply-To: <13099.1431565504@sss.pgh.pa.us> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Pg-Spam-Score: -1.9 (-) 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 Tom Lane wrote, On 2015-05-14 03:05: > Agreed; I think the reason why we disallow this case is not so much > string literals as numeric literals. It would be an even bigger POLA > violation if "ORDER BY 1" and "ORDER BY 1.0" were both accepted and did > fundamentally different things. If that helps, I don't think of that as violating the POLA significantly. This is IMO a much worse violation: =$ WITH test AS (SELECT 1 UNION ALL SELECT 0) SELECT * FROM test ORDER BY 1; ?column? ---------- 0 1 (2 rows) =$ WITH test AS (SELECT 1 UNION ALL SELECT 0) SELECT * FROM test ORDER BY 1::integer; ?column? ---------- 1 0 (2 rows) especially since the latter ORDER BY clause is more likely to be the result of a dumb automatic query generator that appends types to every expression. But I, as an user, understand and accept that appending a type changes the meaning of the ORDER BY. -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs