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

Tom Lane <tgl 'at' sss.pgh.pa.us> writes:

> 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.

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



view thread (6+ messages)

Message-ID: <8764xz822q.fsf@meuh.mnc.ch>
Permalink:  ../8764xz822q.fsf@meuh.mnc.ch/
Also on:    postgresql.org/message-id/8764xz822q.fsf@meuh.mnc.ch

 · 

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: gc@mnc.ch, tgl@sss.pgh.pa.us
  Subject: Re: postgresql-8.0.jar and failure of ORDER BY parameters
  In-Reply-To: <8764xz822q.fsf@meuh.mnc.ch>
  References: <874qdjpfe5.fsf@meuh.mnc.ch> <17996.1115216059@sss.pgh.pa.us> <87ekcn9i85.fsf@meuh.mnc.ch> <18496.1115218236@sss.pgh.pa.us> <8764xz822q.fsf@meuh.mnc.ch>

* 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