This project is archived and is in readonly mode.

#2102 ✓stale
CancelProfileIsBroken

with_scope and :group option fails for PostgreSQL

Reported by CancelProfileIsBroken | February 28th, 2009 @ 05:10 PM | in 3.x

We fail on this using PostgresQL, due to rules on what the SELECT clause contains. Passes in MySQL/SQLite3.

def test_scoped_find_with_group developers = Developer.with_scope(:find => { :group => 'salary' }) do

Developer.find(:all)

end assert_equal 4, developers.size end

=> ActiveRecord::StatementInvalid: PGError: ERROR: column "developers.id" must appear in the GROUP BY clause or be used in an aggregate function : SELECT * FROM "developers" GROUP BY salary

Diff with the failing test attached. No patch yet.

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="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>

Attachments

Pages