Patch #14013
closedPg 8.4 support for Run charts
0%
Description
When trying to display run charts on redmine with pg backend, the query causes syntax error:
ActiveRecord::StatementInvalid (PG::Error: ERROR: syntax error at or near "`"
LINE 1: ...op_key, DATE created_on from `journals`...
^
: select * from (select old_value as value, journalized_id as issueId, prop_key, DATE created_on from `journals` inner join journal_details on (journals.id = journal_id) inner join issues
on (issues.id = journalized_id) where journalized_type = 'Issue' and property = 'attr' and (prop_key = 'estimated_hours' or prop_key = 'done_ratio') and project_id = 4 order by journals.id desc) a group by `
issueId`, created_on, prop_key order by created_on desc):
activerecord (3.2.13) lib/active_record/connection_adapters/postgresql_adapter.rb:1161:in `async_exec'
activerecord (3.2.13) lib/active_record/connection_adapters/postgresql_adapter.rb:1161:in `exec_no_cache'
activerecord (3.2.13) lib/active_record/connection_adapters/postgresql_adapter.rb:660:in `block in exec_query'
activerecord (3.2.13) lib/active_record/connection_adapters/abstract_adapter.rb:280:in `block in log'
activesupport (3.2.13) lib/active_support/notifications/instrumenter.rb:20:in `instrument'
activerecord (3.2.13) lib/active_record/connection_adapters/abstract_adapter.rb:275:in `log'
activerecord (3.2.13) lib/active_record/connection_adapters/postgresql_adapter.rb:659:in `exec_query'
activerecord (3.2.13) lib/active_record/connection_adapters/postgresql_adapter.rb:1256:in `select'
activerecord (3.2.13) lib/active_record/connection_adapters/abstract/database_statements.rb:18:in `select_all'
activerecord (3.2.13) lib/active_record/connection_adapters/abstract/query_cache.rb:61:in `block in select_all'
activerecord (3.2.13) lib/active_record/connection_adapters/abstract/query_cache.rb:75:in `cache_sql'
activerecord (3.2.13) lib/active_record/connection_adapters/abstract/query_cache.rb:61:in `select_all'
plugins/AgileDwarf/app/controllers/adburndown_controller.rb:57:in `show'
...
I managed to get it corrected but am not sure if it's exactly compatible with agile dwarf logic. Here's patch:
diff plugins/AgileDwarf/app/controllers/adburndown_controller.rb /tmp/adburndown_controller.rb 57c57 < ActiveRecord::Base.connection.select_all("select * from (select old_value as value, journalized_id as issueId, prop_key, DATE(journals.created_on) created_on from journals inner join journal_details on (journals.id = journal_id) inner join issues on (issues.id = journalized_id) where journalized_type = 'Issue' and property = 'attr' and (prop_key = 'estimated_hours' or prop_key = 'done_ratio') and #{restcondchanges} order by journals.id desc) a group by issueId, created_on, prop_key, a.value order by created_on desc").each{|row| @changes << row} --- > ActiveRecord::Base.connection.select_all("select * from (select old_value as value, journalized_id as issueId, prop_key, DATE(journals.created_on) created_on from `journals` inner join journal_details on (journals.id = journal_id) inner join issues on (issues.id = journalized_id) where journalized_type = 'Issue' and property = 'attr' and (prop_key = 'estimated_hours' or prop_key = 'done_ratio') and #{restcondchanges} order by journals.id desc) a group by `issueId`, created_on, prop_key order by created_on desc").each{|row| @changes << row} 80c80
bg info:
About your application's environment
Ruby version 1.9.3 (i686-linux)
RubyGems version 1.8.25
Rack version 1.4
Rails version 3.2.13
Active Record version 3.2.13
Action Pack version 3.2.13
Active Resource version 3.2.13
Action Mailer version 3.2.13
Active Support version 3.2.13
Middleware Rack::Cache, ActionDispatch::Static, Rack::Lock, #<ActiveSupport::Cache::Strategy::LocalCache::Middleware:0xa3a1060>, Rack::Runtime, Rack::MethodOverride, ActionDispatch::RequestId, Rails::Rack::Logger, ActionDispatch::ShowExceptions, ActionDispatch::DebugExceptions, ActionDispatch::RemoteIp, ActionDispatch::Callbacks, ActiveRecord::ConnectionAdapters::ConnectionManagement, ActiveRecord::QueryCache, ActionDispatch::Cookies, ActionDispatch::Session::CookieStore, ActionDispatch::Flash, ActionDispatch::ParamsParser, ActionDispatch::Head, Rack::ConditionalGet, Rack::ETag, ActionDispatch::BestStandardsSupport, OpenIdAuthentication
Application root /opt/redmine-2.3.0
Environment production
Database adapter postgresql
Database schema version 20130217094251
pg version: 8.4
Updated by Toshi MARUYAMA over 11 years ago
- Status changed from New to Closed
This is the issue tracker for Redmine core.
Please contact plugin author.