pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Guillaume Cottenceau <gc@mnc.ch>
Cc: pgsql-jdbc@postgresql.org
Subject: Re: postgresql-8.0.jar and failure of ORDER BY parameters
Date: Wed, 04 May 2005 10:50:36 -0400
Message-ID: <18496.1115218236@sss.pgh.pa.us> (raw)
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>

Guillaume Cottenceau <gc@mnc.ch> 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



view thread (6+ messages)  latest in thread

Message-ID: <18496.1115218236@sss.pgh.pa.us>
Permalink:  ../18496.1115218236@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/18496.1115218236@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-jdbc@postgresql.org
  Cc: tgl@sss.pgh.pa.us, gc@mnc.ch
  Subject: Re: postgresql-8.0.jar and failure of ORDER BY parameters
  In-Reply-To: <18496.1115218236@sss.pgh.pa.us>
  References: <874qdjpfe5.fsf@meuh.mnc.ch> <17996.1115216059@sss.pgh.pa.us> <87ekcn9i85.fsf@meuh.mnc.ch> <18496.1115218236@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox