This project is archived and is in readonly mode.
count ordered assn w/ postgres
Reported by Gary Yngve | August 28th, 2008 @ 06:01 AM | in 2.x
Postgres is much stricter than Mysql and barfs if a sql statement has both select count() and an order clause. Unfortunately, if a count_by_sql isn't provided for an association governed by a find_by_sql with an order clause, ActiveRecord will substitute the select clause with count() and neglect to drop the order clause.
We patched our Rails to drop the order clause (by finding the last occurrence of order by). Maybe there's some other reason why this is a bad idea (some SQL code that gets broken by this).
Mostly just making yall aware of the issue...
Comments and changes to this ticket
-
josh December 3rd, 2008 @ 03:26 PM
- State changed from new to stale
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile »
<h2 style="font-size: 14px">Tickets have moved to Github</h2>
The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>