Re: postgresql-8.0.jar and failure of ORDER BY parameters

From: Guillaume Cottenceau <gc(at)mnc(dot)ch>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-jdbc(at)postgresql(dot)org
Subject: Re: postgresql-8.0.jar and failure of ORDER BY parameters
Date: 2005-05-04 15:04:29
Message-ID: 8764xz822q.fsf@meuh.mnc.ch
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

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

> Guillaume Cottenceau <gc(at)mnc(dot)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

In response to

Browse pgsql-jdbc by date

  From Date Subject
Next Message Nahum Castro 2005-05-05 04:34:25 Re: Connectivity of postgreSQL database to a JSP page
Previous Message Tom Lane 2005-05-04 14:50:36 Re: postgresql-8.0.jar and failure of ORDER BY parameters