pg.ddx.io  pgsql-interfaces@postgresql.org mailing list archive  
help / color / mirror / Atom feed
query works in psql, but not thru JDBC
2+ messages / 2 participants
[nested] [flat]

* query works in psql, but not thru JDBC
@ 2001-06-05 10:52 Arsalan Zaidi <azaidi@directi.com>
  2001-06-05 14:16 ` Re: query works in psql, but not thru JDBC Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 1 reply; 2+ messages in thread

From: Arsalan Zaidi @ 2001-06-05 10:52 UTC (permalink / raw)
  To: pgsql-interfaces

Hi.

I'm running this query, which is constructed from parameters passed to a
function.

SELECT * FROM users WHERE userid = 4 ORDER BY name LIMIT 20 OFFSET 0

When I run it from the command line inpsql, It works just fine, but when I
run it using the Postgresql JDBC driver (executeQuery()), I get this error

------------------------
Err Mesg : ERROR: Attribute users.name must be GROUPed or used in an
aggregate function

SQL State : NULL
Error Code : 0
------------------------

Why does it work from the command line and not through JDBC?

Thanks in advance.

--Arsalan.




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

* Re: query works in psql, but not thru JDBC
  2001-06-05 10:52 query works in psql, but not thru JDBC Arsalan Zaidi <azaidi@directi.com>
@ 2001-06-05 14:16 ` Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 2+ messages in thread

From: Tom Lane @ 2001-06-05 14:16 UTC (permalink / raw)
  To: Arsalan Zaidi <azaidi@directi.com>; +Cc: pgsql-interfaces

"Arsalan Zaidi" <azaidi@directi.com> writes:
> SELECT * FROM users WHERE userid = 4 ORDER BY name LIMIT 20 OFFSET 0

> When I run it from the command line inpsql, It works just fine, but when I
> run it using the Postgresql JDBC driver (executeQuery()), I get this error

> Err Mesg : ERROR: Attribute users.name must be GROUPed or used in an
> aggregate function

Curious.  Does JDBC alter the query at all before it sends it?  Try
turning on query logging at the postmaster, and look in the postmaster
log to see what is actually being sent.

			regards, tom lane



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


end of thread, other threads:[~2001-06-05 14:16 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2001-06-05 10:52 query works in psql, but not thru JDBC Arsalan Zaidi <azaidi@directi.com>
2001-06-05 14:16 ` Tom Lane <tgl@sss.pgh.pa.us>

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