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 0666B533B5 for ; Wed, 4 May 2005 11:50:51 -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 70824-02 for ; Wed, 4 May 2005 14:50:38 +0000 (GMT) Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by svr1.postgresql.org (Postfix) with ESMTP id 3A97C549BF for ; Wed, 4 May 2005 11:50:33 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id j44EoamP018497; Wed, 4 May 2005 10:50:36 -0400 (EDT) To: Guillaume Cottenceau Cc: pgsql-jdbc@postgresql.org Subject: Re: postgresql-8.0.jar and failure of ORDER BY parameters In-reply-to: <87ekcn9i85.fsf@meuh.mnc.ch> References: <874qdjpfe5.fsf@meuh.mnc.ch> <17996.1115216059@sss.pgh.pa.us> <87ekcn9i85.fsf@meuh.mnc.ch> Comments: In-reply-to Guillaume Cottenceau message dated "04 May 2005 16:30:18 +0200" Date: Wed, 04 May 2005 10:50:36 -0400 Message-ID: <18496.1115218236@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.006 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200505/19 X-Sequence-Number: 12850 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. 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? regards, tom lane