[Rails] Re: group() and PostgreSQL strange behavior

2011-03-03 Thread Fernando Perez
> I tried, and received the same result: > > User.group(:first_name) The thing is, we group for a reason. So PostgreSQL is expecting that reason to appear, e.g: count(), sum(), etc. -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google

[Rails] Re: group() and PostgreSQL strange behavior

2011-03-02 Thread Brian Ledsworth
Actually, as I think about it, you shouldn't have a Select * in a Group By? You should select the column(s) you want to aggregate. Check this out: http://stackoverflow.com/questions/1769361/postgresql-group-by-different-from-mysql -- Posted via http://www.ruby-forum.com/. -- You received thi

[Rails] Re: group() and PostgreSQL strange behavior

2011-03-02 Thread Brian Ledsworth
I checked my install and received the same results. Looks like a PostgreSQL syntax thing. I'm new to PostgreSQL and have not looked at group by SQL syntax. Off the top of my head, as a (non recommended) work around, you could insert a .select() with a column list, and it should work. That,

[Rails] Re: group() and PostgreSQL strange behavior

2011-03-02 Thread Fernando Perez
Eureka! The docs are incomplete. I obviously need to add a count, sum, etc method for the grouping to make sense. -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send em