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 03657549E1 for ; Wed, 4 May 2005 12:04:53 -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 73435-08 for ; Wed, 4 May 2005 15:04:43 +0000 (GMT) Received: from mnc.ch (www.mnc.ch [212.23.250.43]) by svr1.postgresql.org (Postfix) with ESMTP id 4BFB2549AE for ; Wed, 4 May 2005 12:04:39 -0300 (ADT) Received: (qmail 11585 invoked from network); 4 May 2005 17:04:33 +0200 Received: from 62-2-77-204.business.cablecom.ch (HELO meuh.mnc.ch) (62.2.77.204) by www.mnc.ch with SMTP; 4 May 2005 17:04:33 +0200 Received: by meuh.mnc.ch (Postfix, from userid 1000) id 55FDF23EF18; Wed, 4 May 2005 17:04:29 +0200 (CEST) To: Tom Lane Cc: pgsql-jdbc@postgresql.org Subject: Re: postgresql-8.0.jar and failure of ORDER BY parameters References: <874qdjpfe5.fsf@meuh.mnc.ch> <17996.1115216059@sss.pgh.pa.us> <87ekcn9i85.fsf@meuh.mnc.ch> <18496.1115218236@sss.pgh.pa.us> From: Guillaume Cottenceau Date: 04 May 2005 17:04:29 +0200 In-Reply-To: <18496.1115218236@sss.pgh.pa.us> Message-ID: <8764xz822q.fsf@meuh.mnc.ch> Lines: 29 User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.4 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.051 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200505/20 X-Sequence-Number: 12851 Tom Lane writes: > Guillaume Cottenceau writes: > > I'd better write for example: > > actionSt.setString( 1, "surname" ) > > in order to sort by the value of the column named "surname", but > > this has never "worked". Is it supposed to work now? > > No, that's just a different way of sorting by a constant. > > Parameters are *values*, they are not references to columns, and so > there is no way to do what you want. The fact that it happened to > work like that before was an implementation artifact that has now > gone away. Ok. > AFAICS you'll have to set up multiple prepared statements with all the > different orderings you want. This is not different from having to set > up different statements depending on which columns you want displayed > --- would you expect "SELECT ? FROM mytab" to allow run-time > selection of a column? True enough. Thanks for the light. -- Guillaume Cottenceau