Re: ERROR in 8.0 driver, but not 7.4: SELECT DISTINCT, ORDER

From: Dave Cramer <pg(at)fastcrypt(dot)com>
To: sumit shah <shah(at)ucla(dot)edu>
Cc: pgsql-jdbc(at)postgresql(dot)org
Subject: Re: ERROR in 8.0 driver, but not 7.4: SELECT DISTINCT, ORDER
Date: 2005-05-12 16:57:53
Message-ID: 42838B11.1040207@fastcrypt.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

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

In response to

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message Jesse 2005-05-12 17:31:59 Re: bytea encoding
Previous Message sumit shah 2005-05-12 16:46:55 ERROR in 8.0 driver, but not 7.4: SELECT DISTINCT, ORDER BY expressions must appear in select list