Project

General

Profile

Bug #939

Invalid PostgreSQL statement in 0.3rc2

Added by Jeffrey Ollie over 9 years ago. Updated over 9 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Database
Target version:
Difficulty:
Triaged:
No
Bugzilla link:
Pull request:
Fixed in Releases:
Found in Releases:

Description

I upgraded to 0.3rc2 and am now getting the following in the logs whenever I try and bring up the web page:


Processing HostsController#index (for 161.210.45.73 at 2011-05-24 13:09:28) [GET]
  Parameters: {"action"=>"index", "controller"=>"hosts"}

ActiveRecord::StatementInvalid (PGError: ERROR:  column "hosts.name" must appear in the GROUP BY clause or be used in an aggregate function
LINE 1: SELECT * FROM "hosts"  GROUP BY hosts.id ORDER BY "hosts"."n...
               ^
: SELECT * FROM "hosts"  GROUP BY hosts.id ORDER BY "hosts"."name" ASC LIMIT 20 OFFSET 0):
  app/controllers/hosts_controller.rb:37:in `index'
  app/controllers/hosts_controller.rb:35:in `index'
  /usr/lib/ruby/1.8/webrick/httpserver.rb:104:in `service'
  /usr/lib/ruby/1.8/webrick/httpserver.rb:65:in `run'
  /usr/lib/ruby/1.8/webrick/server.rb:173:in `start_thread'
  /usr/lib/ruby/1.8/webrick/server.rb:162:in `start'
  /usr/lib/ruby/1.8/webrick/server.rb:162:in `start_thread'
  /usr/lib/ruby/1.8/webrick/server.rb:95:in `start'
  /usr/lib/ruby/1.8/webrick/server.rb:92:in `each'
  /usr/lib/ruby/1.8/webrick/server.rb:92:in `start'
  /usr/lib/ruby/1.8/webrick/server.rb:23:in `start'
  /usr/lib/ruby/1.8/webrick/server.rb:82:in `start'

Rendering /usr/share/foreman/public/500.html (500 Internal Server Error)

I'm using PostgreSQL 9.0.4 as my database.

Associated revisions

Revision 2a5a7f60 (diff)
Added by Ohad Levy over 9 years ago

fixes #939 - Invalid PostgreSQL statement

History

#1 Updated by Ohad Levy over 9 years ago

  • Assignee changed from Ohad Levy to Amos Benari
  • Target version set to 0.3

more info on the matter can be found here: http://stackoverflow.com/questions/1769361/postgresql-group-by-different-from-mysql

a quick workaround might be to remove the group by statement in app/controllers/hosts_controller.rb at line 30
e.g.

search = my_hosts.search_for(params[:search],:order => params[:order])

#2 Updated by Jeffrey Ollie over 9 years ago

Thanks for the quick workaround, that does get me up and running again! Let me know if there's any additional information you need to get a final solution.

#3 Updated by Ohad Levy over 9 years ago

  • Status changed from New to Ready For Testing
  • % Done changed from 0 to 100

#4 Updated by Ohad Levy over 9 years ago

  • Status changed from Ready For Testing to Closed

Also available in: Atom PDF