I'm writing a rails app with the paginating_find plugin and the code I'm writing is generating the following query:
Now Postgresql is complaining here:
I don't understand why it's complaining since I'm not doing anything with orders.id here. Indeed Postgres will complain for every column unless I GROUP BY on it. What's going on here?
Code:
SELECT
*
FROM
orders
WHERE
(orders.region_id = 10000033 AND ((is_buyorder = true )))
GROUP BY
price
ORDER BY
price DESC
LIMIT
30
OFFSET
0
Now Postgresql is complaining here:
Postgresql 8.0 said:ERROR: column "orders.id" must appear in the GROUP BY clause or be used in an aggregate function
I don't understand why it's complaining since I'm not doing anything with orders.id here. Indeed Postgres will complain for every column unless I GROUP BY on it. What's going on here?