Project

General

Profile

Actions

Bug #2054

closed

Invalid SQL on postgres when running rake trends:counter

Added by Ewoud Kohl van Wijngaarden over 11 years ago. Updated over 11 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Category:
Trends
Target version:
Difficulty:
Triaged:
Fixed in Releases:
Found in Releases:

Description

-sh-4.1$ cd /usr/share/foreman && RAILS_ENV=production rake trends:counter --trace
Libvirt binding are missing - hypervisor management is disabled
/usr/lib/ruby/gems/1.8/gems/ruby_parser-2.3.1/lib/ruby_parser_extras.rb:10: warning: already initialized constant ENC_NONE
/usr/lib/ruby/gems/1.8/gems/ruby_parser-2.3.1/lib/ruby_parser_extras.rb:11: warning: already initialized constant ENC_EUC
/usr/lib/ruby/gems/1.8/gems/ruby_parser-2.3.1/lib/ruby_parser_extras.rb:12: warning: already initialized constant ENC_SJIS
/usr/lib/ruby/gems/1.8/gems/ruby_parser-2.3.1/lib/ruby_parser_extras.rb:13: warning: already initialized constant ENC_UTF8
** Invoke trends:counter (first_time)
** Invoke environment (first_time)
** Execute environment
** Execute trends:counter
rake aborted!
PG::Error: ERROR:  column "trends.id" must appear in the GROUP BY clause or be used in an aggregate function
LINE 1: SELECT "trends".* FROM "trends" WHERE "trends"."fact_value" ...
               ^
: SELECT "trends".* FROM "trends" WHERE "trends"."fact_value" IS NULL GROUP BY trendable_type, fact_name
/usr/lib/ruby/gems/1.8/gems/activerecord-3.0.17/lib/active_record/connection_adapters/postgresql_adapter.rb:518:in `exec'
/usr/lib/ruby/gems/1.8/gems/activerecord-3.0.17/lib/active_record/connection_adapters/postgresql_adapter.rb:518:in `execute'
/usr/lib/ruby/gems/1.8/gems/activerecord-3.0.17/lib/active_record/connection_adapters/abstract_adapter.rb:202:in `log'
/usr/lib/ruby/gems/1.8/gems/activesupport-3.0.17/lib/active_support/notifications/instrumenter.rb:21:in `instrument'
/usr/lib/ruby/gems/1.8/gems/activerecord-3.0.17/lib/active_record/connection_adapters/abstract_adapter.rb:200:in `log'
/usr/lib/ruby/gems/1.8/gems/activerecord-3.0.17/lib/active_record/connection_adapters/postgresql_adapter.rb:514:in `execute'
/usr/lib/ruby/gems/1.8/gems/activerecord-3.0.17/lib/active_record/connection_adapters/postgresql_adapter.rb:1004:in `select_raw'
/usr/lib/ruby/gems/1.8/gems/activerecord-3.0.17/lib/active_record/connection_adapters/postgresql_adapter.rb:997:in `select'
/usr/lib/ruby/gems/1.8/gems/activerecord-3.0.17/lib/active_record/connection_adapters/abstract/database_statements.rb:7:in `select_all'
/usr/lib/ruby/gems/1.8/gems/activerecord-3.0.17/lib/active_record/connection_adapters/abstract/query_cache.rb:56:in `select_all'
/usr/lib/ruby/gems/1.8/gems/activerecord-3.0.17/lib/active_record/base.rb:473:in `find_by_sql'
/usr/lib/ruby/gems/1.8/gems/activerecord-3.0.17/lib/active_record/relation.rb:64:in `to_a'
/usr/lib/ruby/gems/1.8/gems/activerecord-3.0.17/lib/active_record/relation.rb:13:in `each'
/usr/share/foreman/app/models/trend_importer.rb:27:in `update_trend_counters'
/usr/share/foreman/app/models/trend_importer.rb:6:in `update!'
/usr/share/foreman/lib/tasks/trends.rake:5
/usr/lib/ruby/gems/1.8/gems/rake-0.9.2.2/lib/rake/task.rb:205:in `call'
/usr/lib/ruby/gems/1.8/gems/rake-0.9.2.2/lib/rake/task.rb:205:in `execute'
/usr/lib/ruby/gems/1.8/gems/rake-0.9.2.2/lib/rake/task.rb:200:in `each'
/usr/lib/ruby/gems/1.8/gems/rake-0.9.2.2/lib/rake/task.rb:200:in `execute'
/usr/lib/ruby/gems/1.8/gems/rake-0.9.2.2/lib/rake/task.rb:158:in `invoke_with_call_chain'
/usr/lib/ruby/1.8/monitor.rb:242:in `synchronize'
/usr/lib/ruby/gems/1.8/gems/rake-0.9.2.2/lib/rake/task.rb:151:in `invoke_with_call_chain'
/usr/lib/ruby/gems/1.8/gems/rake-0.9.2.2/lib/rake/task.rb:144:in `invoke'
/usr/lib/ruby/gems/1.8/gems/rake-0.9.2.2/lib/rake/application.rb:116:in `invoke_task'
/usr/lib/ruby/gems/1.8/gems/rake-0.9.2.2/lib/rake/application.rb:94:in `top_level'
/usr/lib/ruby/gems/1.8/gems/rake-0.9.2.2/lib/rake/application.rb:94:in `each'
/usr/lib/ruby/gems/1.8/gems/rake-0.9.2.2/lib/rake/application.rb:94:in `top_level'
/usr/lib/ruby/gems/1.8/gems/rake-0.9.2.2/lib/rake/application.rb:133:in `standard_exception_handling'
/usr/lib/ruby/gems/1.8/gems/rake-0.9.2.2/lib/rake/application.rb:88:in `top_level'
/usr/lib/ruby/gems/1.8/gems/rake-0.9.2.2/lib/rake/application.rb:66:in `run'
/usr/lib/ruby/gems/1.8/gems/rake-0.9.2.2/lib/rake/application.rb:133:in `standard_exception_handling'
/usr/lib/ruby/gems/1.8/gems/rake-0.9.2.2/lib/rake/application.rb:63:in `run'
/usr/lib/ruby/gems/1.8/gems/rake-0.9.2.2/bin/rake:33
/usr/bin/rake:19:in `load'
/usr/bin/rake:19
Tasks: TOP => trends:counter
Actions #1

Updated by Ohad Levy over 11 years ago

  • Category set to Trends
  • Target version set to 1.1

i saw a fix here -> https://github.com/rbirnie/foreman/pull/1

but there is a performance question at the moment, therefore its not merged yet.

Actions #2

Updated by Joseph Magen over 11 years ago

  • Status changed from New to Ready For Testing
Actions #3

Updated by Ohad Levy over 11 years ago

  • Status changed from Ready For Testing to Closed

fixed at 86dcc03

Actions

Also available in: Atom PDF