X-Original-To: pgsql-jdbc-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 2F2DF53E1D for ; Thu, 12 May 2005 13:58:02 -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 79923-07 for ; Thu, 12 May 2005 16:57:59 +0000 (GMT) Received: from net2.micro-automation.com (net2.micro-automation.com [64.7.141.29]) by svr1.postgresql.org (Postfix) with SMTP id 57D0E53DAB for ; Thu, 12 May 2005 13:57:58 -0300 (ADT) Received: (qmail 14695 invoked from network); 12 May 2005 16:56:25 -0000 Received: from dcdsl.ebox.com (HELO ?192.168.1.36?) (davec@64.7.143.116) by net2.micro-automation.com with SMTP; 12 May 2005 16:56:25 -0000 Message-ID: <42838B11.1040207@fastcrypt.com> Date: Thu, 12 May 2005 12:57:53 -0400 From: Dave Cramer Reply-To: pg@fastcrypt.com Organization: Postgres International User-Agent: Mozilla Thunderbird 1.0 (X11/20041206) X-Accept-Language: en-us, en MIME-Version: 1.0 To: sumit shah Cc: pgsql-jdbc@postgresql.org Subject: Re: ERROR in 8.0 driver, but not 7.4: SELECT DISTINCT, ORDER References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.027 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200505/63 X-Sequence-Number: 12894 Yes, it is expected behaviour see http://archives.postgresql.org/pgsql-jdbc/2005-05/msg00013.php for details. sumit shah wrote: > Dear Postgres JDBC hackers: > > I've just recently started testing the postgres JDBC 3 driver > (8.0-311) after using JDBC 3 (pg74.216.jdbc). I now get an error on > a query of the type: > > SELECT DISTINCT column1, column2 FROM table1 ORDER BY 1 > > where the "1" in the ORDER BY is set by PreparedStatement.setInt method > > The error is: "SELECT DISTINCT, ORDER BY expressions must appear in > select list" > > The error disappears when I change the query to: > > SELECT DISTINCT column1, column2 FROM table1 ORDER BY column1 > > or when I hard code the ORDER BY 1 in the query instead of setting it > via setInt. > > This error occurs only with the 8.0-311 driver or the 8.1dev-400 jdbc > drivers, it does not occur with the pg74-216 driver. This occurs > with both the 7.4 and 8.0 backends. > > Is this change in behavior expected and our code was simply relying > on old semantics or misinterpretation of the JDBC standard? > > Thanks, > Sumit > > ---------------------------(end of broadcast)--------------------------- > TIP 4: Don't 'kill -9' the postmaster > > -- Dave Cramer http://www.postgresintl.com 519 939 0336 ICQ#14675561