This project is archived and is in readonly mode.

#923 ✓stale
Gary Yngve

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

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=""></a>

People watching this ticket