Failing query... - Mailing list pgsql-sql

From Shaun
Subject Failing query...
Date
Msg-id Pine.LNX.4.21.0008191544490.2397-100000@ftoomsh.progsoc.uts.edu.au
Whole thread Raw
Responses Re: Failing query...  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-sql
Hi All,

I was hoping someone here would be able to help me with a query I have
that is failing with the error:

psql:query:1: ERROR:  ExecEvalExpr: unknown expression type 501

The query is:

SELECT a.auction_id, a.user_id, c.other_names,      c.surname, c.email, a.reserve, a.close_time, a.short_desc,
a.long_desc,a.start_time,      (COALESCE((select MAX(bid) from bid where auction_id = a.auction_id      group by
auction_id),0)) as max_bid
 
FROM Auction a, Customer c
WHERE a.user_id = c.user_id
AND a.auction_id = 754;

If I run the following however, 

SELECT a.auction_id, a.user_id, c.other_names,      c.surname, c.email, a.reserve, a.close_time, a.short_desc,
a.long_desc,a.start_time
 
FROM Auction a, Customer c
WHERE a.user_id = c.user_id
AND a.auction_id = 754;

I get:
auction_id | user_id | other_names |  surname  |            email
|
reserve  |       close_time       |      short_desc       |
long_de
sc              |       start_time
------------+---------+-------------+-----------+-----------------------------+-
---------+------------------------+-----------------------+---------------------
----------------+------------------------       754 |       4 | raymond     | villarica |
ray@woodstock.tabnsw.com.au |
22000.00 | 2000-08-17 17:12:16+10 | 8 Avona Av Glebe 2037 | other
residential 70
8 square metres | 1990-01-01 00:00:00+11
(1 row)

If I run:

select MAX(bid) from bid where auction_id = 754;

I get:
   max
------------3100000.00
(1 row)

Can someone please help me understand what I'm doing wrong. If there is no
value in the select max() subselect, the query works, but if there is, it
doesn't.

Please CC: me to any reply as I've emailed to join the list but the reply
hasn't yet reached me from majordomo.

Thanks,
Shaun



pgsql-sql by date:

Previous
From: Christopher Sawtell
Date:
Subject: Tuple size limit.
Next
From: Tom Lane
Date:
Subject: Re: Failing query...