pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Dave Cramer <pg@fastcrypt.com>
To: sumit shah <shah@ucla.edu>
Cc: pgsql-jdbc@postgresql.org
Subject: Re: ERROR in 8.0 driver, but not 7.4: SELECT DISTINCT, ORDER
Date: Thu, 12 May 2005 12:57:53 -0400
Message-ID: <42838B11.1040207@fastcrypt.com> (raw)
In-Reply-To: <FAAF6A95-5B9F-49C9-9808-782F808E4844@ucla.edu>
References: <FAAF6A95-5B9F-49C9-9808-782F808E4844@ucla.edu>

Yes, it is expected behaviour

see

http://archives.postgresql.org/pgsql-jdbc/2005-05/msg00013.php

for details.

sumit shah wrote:

> Dear Postgres JDBC hackers:
>
> I've just recently started testing the postgres JDBC 3 driver  
> (8.0-311) after using JDBC 3 (pg74.216.jdbc).  I now get an error on  
> a query of the type:
>
> SELECT DISTINCT column1, column2 FROM table1 ORDER BY 1
>
> where the "1" in the ORDER BY is set by PreparedStatement.setInt method
>
> The error is: "SELECT DISTINCT, ORDER BY expressions must appear in  
> select list"
>
> The error disappears when I change the query to:
>
> SELECT DISTINCT column1, column2 FROM table1 ORDER BY  column1
>
> or when I hard code the ORDER BY 1 in the query instead of setting it  
> via setInt.
>
> This error occurs only with the 8.0-311 driver or the 8.1dev-400 jdbc  
> drivers, it does not occur with the pg74-216 driver.  This occurs  
> with both the 7.4 and 8.0 backends.
>
> Is this change in behavior expected and our code was simply relying  
> on old semantics or misinterpretation of the JDBC standard?
>
> Thanks,
> Sumit
>
> ---------------------------(end of broadcast)---------------------------
> TIP 4: Don't 'kill -9' the postmaster
>
>

-- 
Dave Cramer
http://www.postgresintl.com
519 939 0336
ICQ#14675561




view thread (2+ messages)

Message-ID: <42838B11.1040207@fastcrypt.com>
Permalink:  ../42838B11.1040207@fastcrypt.com/
Also on:    postgresql.org/message-id/42838B11.1040207@fastcrypt.com

 · 

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: pg@fastcrypt.com, shah@ucla.edu
  Subject: Re: ERROR in 8.0 driver, but not 7.4: SELECT DISTINCT, ORDER
  In-Reply-To: <42838B11.1040207@fastcrypt.com>
  References: <FAAF6A95-5B9F-49C9-9808-782F808E4844@ucla.edu> <42838B11.1040207@fastcrypt.com>

* 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