Created
October 11, 2015 19:22
-
-
Save soilforlifeforms/f51ad2de74039862c43f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Gardener.joins(:support_visits).group(:gardener_id).select("SUM(CASE WHEN count(gardener_id) = 1 THEN 1 END) AS z | |
D, [2015-10-11T19:21:42.481818 #3] DEBUG -- : Gardener Load (1.2ms) SELECT SUM(CASE WHEN count(gardener_id) = 1 THEN 1 END) AS zero_count FROM "gardeners" INNER JOIN "support_visits" ON "support_visits"."gardener_id" = "gardeners"."id" GROUP BY gardener_id | |
PG::GroupingError: ERROR: aggregate function calls cannot be nested | |
LINE 1: SELECT SUM(CASE WHEN count(gardener_id) = 1 THEN 1 END) AS z... | |
^ | |
: SELECT SUM(CASE WHEN count(gardener_id) = 1 THEN 1 END) AS zero_count FROM "gardeners" INNER JOIN "support_visits" ON "support_visits"."gardener_id" = "gardeners"."id" GROUP BY gardener_id | |
PG::GroupingError: ERROR: aggregate function calls cannot be nested | |
LINE 1: SELECT SUM(CASE WHEN count(gardener_id) = 1 THEN 1 END) AS z... | |
^ | |
: SELECT SUM(CASE WHEN count(gardener_id) = 1 THEN 1 END) AS zero_count FROM "gardeners" INNER JOIN "support_visits" ON "support_visits"."gardener_id" = "gardeners"."id" GROUP BY gardener_id | |
ActiveRecord::StatementInvalid: PG::GroupingError: ERROR: aggregate function calls cannot be nested | |
LINE 1: SELECT SUM(CASE WHEN count(gardener_id) = 1 THEN 1 END) AS z... | |
^ | |
: SELECT SUM(CASE WHEN count(gardener_id) = 1 THEN 1 END) AS zero_count FROM "gardeners" INNER JOIN "support_visits" ON "support_visits"."gardener_id" = "gardeners"."id" GROUP BY gardener_id | |
from /app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.4/lib/active_record/connection_adapters/postgresql_adapter.rb:822:in `async_exec' | |
from /app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.4/lib/active_record/connection_adapters/postgresql_adapter.rb:822:in `block in exec_no_cache' | |
from /app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.4/lib/active_record/connection_adapters/abstract_adapter.rb:373:in `block in log' | |
from /app/vendor/bundle/ruby/2.1.0/gems/activesupport-4.1.4/lib/active_support/notifications/instrumenter.rb:20:in `instrument' | |
from /app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.4/lib/active_record/connection_adapters/abstract_adapter.rb:367:in `log' | |
from /app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.4/lib/active_record/connection_adapters/postgresql_adapter.rb:822:in `exec_no_cache' | |
from /app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.4/lib/active_record/connection_adapters/postgresql/database_statements.rb:137:in `exec_query' | |
from /app/vendor/bundle/ruby/2.1.0/gems/oboe-2.7.8.1/lib/oboe/frameworks/rails/inst/connection_adapters/utils.rb:74:in `exec_query_with_oboe' | |
from /app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.4/lib/active_record/connection_adapters/postgresql_adapter.rb:954:in `select' | |
from /app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.4/lib/active_record/connection_adapters/abstract/database_statements.rb:24:in `select_all' | |
from /app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.4/lib/active_record/connection_adapters/abstract/query_cache.rb:70:in `select_all' | |
from /app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.4/lib/active_record/querying.rb:39:in `find_by_sql' | |
from /app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.4/lib/active_record/relation.rb:604:in `exec_queries' | |
from /app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.4/lib/active_record/relation.rb:486:in `load' | |
from /app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.4/lib/active_record/relation.rb:231:in `to_a' | |
from /app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.4/lib/active_record/relation.rb:595:in `inspect' | |
from /app/vendor/bundle/ruby/2.1.0/gems/railties-4.1.4/lib/rails/commands/console.rb:90:in `start' | |
from /app/vendor/bundle/ruby/2.1.0/gems/railties-4.1.4/lib/rails/commands/console.rb:9:in `start' | |
from /app/vendor/bundle/ruby/2.1.0/gems/railties-4.1.4/lib/rails/commands/commands_tasks.rb:69:in `console' | |
from /app/vendor/bundle/ruby/2.1.0/gems/railties-4.1.4/lib/rails/commands/commands_tasks.rb:40:in `run_command!' | |
from /app/vendor/bundle/ruby/2.1.0/gems/railties-4.1.4/lib/rails/commands.rb:17:in `<top (required)>' | |
from bin/rails:8:in `require' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment