pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
ERROR in 8.0 driver, but not 7.4: SELECT DISTINCT, ORDER BY expressions must appear in select list
2+ messages / 2 participants
[nested] [flat]

* ERROR in 8.0 driver, but not 7.4: SELECT DISTINCT, ORDER BY expressions must appear in select list
@ 2005-05-12 16:46  sumit shah <shah@ucla.edu>
  0 siblings, 1 reply; 2+ messages in thread

From: sumit shah @ 2005-05-12 16:46 UTC (permalink / raw)
  To: pgsql-jdbc

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



^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: ERROR in 8.0 driver, but not 7.4: SELECT DISTINCT, ORDER
@ 2005-05-12 16:57  Dave Cramer <pg@fastcrypt.com>
  parent: sumit shah <shah@ucla.edu>
  0 siblings, 0 replies; 2+ messages in thread

From: Dave Cramer @ 2005-05-12 16:57 UTC (permalink / raw)
  To: sumit shah <shah@ucla.edu>; +Cc: 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




^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2005-05-12 16:57 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2005-05-12 16:46 ERROR in 8.0 driver, but not 7.4: SELECT DISTINCT, ORDER BY expressions must appear in select list sumit shah <shah@ucla.edu>
2005-05-12 16:57 ` Re: ERROR in 8.0 driver, but not 7.4: SELECT DISTINCT, ORDER Dave Cramer <pg@fastcrypt.com>

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