Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pg 8.4 support for Run charts #68

Open
mrkafk opened this issue May 8, 2013 · 2 comments
Open

Pg 8.4 support for Run charts #68

mrkafk opened this issue May 8, 2013 · 2 comments

Comments

@mrkafk
Copy link

mrkafk commented May 8, 2013

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

@SonRiab
Copy link

SonRiab commented May 16, 2013

Works for me too! Thx!

@ovidiuvisan
Copy link

nice! worked!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants