Open AntonTsaberyaby opened 6 years ago
Hello
I meet the same issue.
What I've found so far is that it's cause by the use of table 'enumeration" several times. For instance, my query use enumeration for display (display of the priority) and for sorting (issues sort by priority).
How to solve that ? No idea !
A bypass : Be sure that you don't use several times the same field in a request.
Cédric
Hi guys,
I have the same issue.
I do i resolve it?
Regards,
This can also happen with "group by".
In my case the query joins the trackers
table twice, but the second time there is no quotation of table and attribute names:
SELECT ...
FROM "issues"
INNER JOIN "projects" ON "projects"."id" = "issues"."project_id"
INNER JOIN "issue_statuses" ON "issue_statuses"."id" = "issues"."status_id"
LEFT OUTER JOIN "users" ON "users"."id" = "issues"."assigned_to_id"
LEFT OUTER JOIN "trackers" ON "trackers"."id" = "issues"."tracker_id"
LEFT OUTER JOIN "enumerations" ON "enumerations"."id" = "issues"."priority_id" AND "enumerations"."type" IN ('IssuePriority')
LEFT OUTER JOIN "issue_categories" ON "issue_categories"."id" = "issues"."category_id"
LEFT OUTER JOIN "versions" ON "versions"."id" = "issues"."fixed_version_id"
LEFT OUTER JOIN "issue_supply_items" ON "issue_supply_items"."issue_id" = "issues"."id"
LEFT OUTER JOIN trackers ON trackers.id = issues.tracker_id
WHERE ...
I'm wondering, if this unquoted INNER JOIN
is added by the plugin.
I get a similar error when trying to run this on 3.4.
Query::StatementInvalid: Mysql2::Error: Not unique table/alias: 'users': SELECT `issues`.`id` AS t0_r0, `issues`.`tracker_id` AS t0_r1, `issues`.`project_id` AS t0_r2, `issues`.`subject` AS t0_r3, `issues`.`description` AS t0_r4, `issues`.`due_date` AS t0_r5, `issues`.`category_id` AS t0_r6, `issues`.`status_id` AS t0_r7, `issues`.`assigned_to_id` AS t0_r8, `issues`.`priority_id` AS t0_r9, `issues`.`fixed_version_id` AS t0_r10, `issues`.`author_id` AS t0_r11, `issues`.`lock_version` AS t0_r12, `issues`.`created_on` AS t0_r13, `issues`.`updated_on` AS t0_r14, `issues`.`start_date` AS t0_r15, `issues`.`done_ratio` AS t0_r16, `issues`.`estimated_hours` AS t0_r17, `issues`.`parent_id` AS t0_r18, `issues`.`root_id` AS t0_r19, `issues`.`lft` AS t0_r20, `issues`.`rgt` AS t0_r21, `issues`.`is_private` AS t0_r22, `issues`.`closed_on` AS t0_r23, `issue_statuses`.`id` AS t1_r0, `issue_statuses`.`name` AS t1_r1, `issue_statuses`.`is_closed` AS t1_r2, `issue_statuses`.`position` AS t1_r3, `issue_statuses`.`default_done_ratio` AS t1_r4, `projects`.`id` AS t2_r0, `projects`.`name` AS t2_r1, `projects`.`description` AS t2_r2, `projects`.`homepage` AS t2_r3, `projects`.`is_public` AS t2_r4, `projects`.`parent_id` AS t2_r5, `projects`.`created_on` AS t2_r6, `projects`.`updated_on` AS t2_r7, `projects`.`identifier` AS t2_r8, `projects`.`status` AS t2_r9, `projects`.`lft` AS t2_r10, `projects`.`rgt` AS t2_r11, `projects`.`inherit_members` AS t2_r12, `projects`.`default_assignee_id` AS t2_r13, `projects`.`default_version_id` AS t2_r14, `projects`.`default_assigned_to_id` AS t2_r15, `users`.`id` AS t3_r0, `users`.`login` AS t3_r1, `users`.`hashed_password` AS t3_r2, `users`.`firstname` AS t3_r3, `users`.`lastname` AS t3_r4, `users`.`admin` AS t3_r5, `users`.`status` AS t3_r6, `users`.`last_login_on` AS t3_r7, `users`.`language` AS t3_r8, `users`.`auth_source_id` AS t3_r9, `users`.`created_on` AS t3_r10, `users`.`updated_on` AS t3_r11, `users`.`type` AS t3_r12, `users`.`identity_url` AS t3_r13, `users`.`mail_notification` AS t3_r14, `users`.`salt` AS t3_r15, `users`.`must_change_passwd` AS t3_r16, `users`.`passwd_changed_on` AS t3_r17, `trackers`.`id` AS t4_r0, `trackers`.`name` AS t4_r1, `trackers`.`is_in_chlog` AS t4_r2, `trackers`.`position` AS t4_r3, `trackers`.`is_in_roadmap` AS t4_r4, `trackers`.`fields_bits` AS t4_r5, `trackers`.`default_status_id` AS t4_r6, `enumerations`.`id` AS t5_r0, `enumerations`.`name` AS t5_r1, `enumerations`.`position` AS t5_r2, `enumerations`.`is_default` AS t5_r3, `enumerations`.`type` AS t5_r4, `enumerations`.`active` AS t5_r5, `enumerations`.`project_id` AS t5_r6, `enumerations`.`parent_id` AS t5_r7, `enumerations`.`position_name` AS t5_r8, `issue_categories`.`id` AS t6_r0, `issue_categories`.`project_id` AS t6_r1, `issue_categories`.`name` AS t6_r2, `issue_categories`.`assigned_to_id` AS t6_r3, `versions`.`id` AS t7_r0, `versions`.`project_id` AS t7_r1, `versions`.`name` AS t7_r2, `versions`.`description` AS t7_r3, `versions`.`effective_date` AS t7_r4, `versions`.`created_on` AS t7_r5, `versions`.`updated_on` AS t7_r6, `versions`.`wiki_page_title` AS t7_r7, `versions`.`status` AS t7_r8, `versions`.`sharing` AS t7_r9 FROM `issues` INNER JOIN `projects` ON `projects`.`id` = `issues`.`project_id` INNER JOIN `issue_statuses` ON `issue_statuses`.`id` = `issues`.`status_id` LEFT OUTER JOIN `users` ON `users`.`id` = `issues`.`assigned_to_id` LEFT OUTER JOIN `trackers` ON `trackers`.`id` = `issues`.`tracker_id` LEFT OUTER JOIN `enumerations` ON `enumerations`.`id` = `issues`.`priority_id` AND `enumerations`.`type` IN ('IssuePriority') LEFT OUTER JOIN `issue_categories` ON `issue_categories`.`id` = `issues`.`category_id` LEFT OUTER JOIN `versions` ON `versions`.`id` = `issues`.`fixed_version_id` LEFT OUTER JOIN users ON users.id = issues.assigned_to_id WHERE (projects.status <> 9 AND EXISTS (SELECT 1 AS one FROM enabled_modules em WHERE em.project_id = projects.id AND em.name='issue_tracking')) AND (((issues.status_id IS NULL OR issues.status_id NOT IN ('3'))) AND (issues.due_date <= '2018-07-27 23:59:59.999999') AND (issues.closed_on IS NULL) AND projects.id = 1) ORDER BY users.firstname ASC, users.lastname ASC, users.id ASC, issues.id ASC
/opt/redmine-3.4.6/app/models/issue_query.rb:312:in `rescue in issues'
/opt/redmine-3.4.6/app/models/issue_query.rb:274:in `issues'
/opt/redmine-3.4.6/plugins/redmine_mail_reminder/app/models/mail_reminder_mailer.rb:31:in `block in issues_reminder'
/opt/redmine-3.4.6/plugins/redmine_mail_reminder/app/models/mail_reminder_mailer.rb:29:in `issues_reminder'
/usr/local/rvm/gems/ruby-2.4.4/gems/actionpack-4.2.8/lib/abstract_controller/base.rb:198:in `process_action'
/usr/local/rvm/gems/ruby-2.4.4/gems/actionpack-4.2.8/lib/abstract_controller/callbacks.rb:20:in `block in process_action'
/usr/local/rvm/gems/ruby-2.4.4/gems/activesupport-4.2.8/lib/active_support/callbacks.rb:88:in `__run_callbacks__'
/usr/local/rvm/gems/ruby-2.4.4/gems/activesupport-4.2.8/lib/active_support/callbacks.rb:778:in `_run_process_action_callbacks'
/usr/local/rvm/gems/ruby-2.4.4/gems/activesupport-4.2.8/lib/active_support/callbacks.rb:81:in `run_callbacks'
/usr/local/rvm/gems/ruby-2.4.4/gems/actionpack-4.2.8/lib/abstract_controller/callbacks.rb:19:in `process_action'
/usr/local/rvm/gems/ruby-2.4.4/gems/actionpack-4.2.8/lib/abstract_controller/base.rb:137:in `process'
/usr/local/rvm/gems/ruby-2.4.4/gems/actionview-4.2.8/lib/action_view/rendering.rb:30:in `process'
/usr/local/rvm/gems/ruby-2.4.4/gems/actionmailer-4.2.8/lib/action_mailer/base.rb:596:in `block in process'
/usr/local/rvm/gems/ruby-2.4.4/gems/activesupport-4.2.8/lib/active_support/notifications.rb:164:in `block in instrument'
/usr/local/rvm/gems/ruby-2.4.4/gems/activesupport-4.2.8/lib/active_support/notifications/instrumenter.rb:20:in `instrument'
/usr/local/rvm/gems/ruby-2.4.4/gems/activesupport-4.2.8/lib/active_support/notifications.rb:164:in `instrument'
/usr/local/rvm/gems/ruby-2.4.4/gems/actionmailer-4.2.8/lib/action_mailer/base.rb:593:in `process'
/usr/local/rvm/gems/ruby-2.4.4/gems/actionmailer-4.2.8/lib/action_mailer/base.rb:584:in `initialize'
/usr/local/rvm/gems/ruby-2.4.4/gems/actionmailer-4.2.8/lib/action_mailer/message_delivery.rb:25:in `new'
/usr/local/rvm/gems/ruby-2.4.4/gems/actionmailer-4.2.8/lib/action_mailer/message_delivery.rb:25:in `__getobj__'
/usr/local/rvm/gems/ruby-2.4.4/gems/actionmailer-4.2.8/lib/action_mailer/message_delivery.rb:34:in `message'
/usr/local/rvm/gems/ruby-2.4.4/gems/actionmailer-4.2.8/lib/action_mailer/message_delivery.rb:85:in `deliver_now'
/opt/redmine-3.4.6/config/initializers/10-patches.rb:163:in `deliver'
/opt/redmine-3.4.6/plugins/redmine_mail_reminder/lib/tasks/reminder.rake:43:in `block (4 levels) in <top (required)>'
/opt/redmine-3.4.6/plugins/redmine_mail_reminder/lib/tasks/reminder.rake:42:in `each'
/opt/redmine-3.4.6/plugins/redmine_mail_reminder/lib/tasks/reminder.rake:42:in `block (3 levels) in <top (required)>'
/opt/redmine-3.4.6/plugins/redmine_mail_reminder/app/models/mail_reminder_mailer.rb:21:in `with_synched_deliveries'
/opt/redmine-3.4.6/plugins/redmine_mail_reminder/lib/tasks/reminder.rake:41:in `block (2 levels) in <top (required)>'
/usr/local/rvm/gems/ruby-2.4.4/gems/rake-12.3.1/exe/rake:27:in `<top (required)>'
Caused by:
ActiveRecord::StatementInvalid: Mysql2::Error: Not unique table/alias: 'users': SELECT `issues`.`id` AS t0_r0, `issues`.`tracker_id` AS t0_r1, `issues`.`project_id` AS t0_r2, `issues`.`subject` AS t0_r3, `issues`.`description` AS t0_r4, `issues`.`due_date` AS t0_r5, `issues`.`category_id` AS t0_r6, `issues`.`status_id` AS t0_r7, `issues`.`assigned_to_id` AS t0_r8, `issues`.`priority_id` AS t0_r9, `issues`.`fixed_version_id` AS t0_r10, `issues`.`author_id` AS t0_r11, `issues`.`lock_version` AS t0_r12, `issues`.`created_on` AS t0_r13, `issues`.`updated_on` AS t0_r14, `issues`.`start_date` AS t0_r15, `issues`.`done_ratio` AS t0_r16, `issues`.`estimated_hours` AS t0_r17, `issues`.`parent_id` AS t0_r18, `issues`.`root_id` AS t0_r19, `issues`.`lft` AS t0_r20, `issues`.`rgt` AS t0_r21, `issues`.`is_private` AS t0_r22, `issues`.`closed_on` AS t0_r23, `issue_statuses`.`id` AS t1_r0, `issue_statuses`.`name` AS t1_r1, `issue_statuses`.`is_closed` AS t1_r2, `issue_statuses`.`position` AS t1_r3, `issue_statuses`.`default_done_ratio` AS t1_r4, `projects`.`id` AS t2_r0, `projects`.`name` AS t2_r1, `projects`.`description` AS t2_r2, `projects`.`homepage` AS t2_r3, `projects`.`is_public` AS t2_r4, `projects`.`parent_id` AS t2_r5, `projects`.`created_on` AS t2_r6, `projects`.`updated_on` AS t2_r7, `projects`.`identifier` AS t2_r8, `projects`.`status` AS t2_r9, `projects`.`lft` AS t2_r10, `projects`.`rgt` AS t2_r11, `projects`.`inherit_members` AS t2_r12, `projects`.`default_assignee_id` AS t2_r13, `projects`.`default_version_id` AS t2_r14, `projects`.`default_assigned_to_id` AS t2_r15, `users`.`id` AS t3_r0, `users`.`login` AS t3_r1, `users`.`hashed_password` AS t3_r2, `users`.`firstname` AS t3_r3, `users`.`lastname` AS t3_r4, `users`.`admin` AS t3_r5, `users`.`status` AS t3_r6, `users`.`last_login_on` AS t3_r7, `users`.`language` AS t3_r8, `users`.`auth_source_id` AS t3_r9, `users`.`created_on` AS t3_r10, `users`.`updated_on` AS t3_r11, `users`.`type` AS t3_r12, `users`.`identity_url` AS t3_r13, `users`.`mail_notification` AS t3_r14, `users`.`salt` AS t3_r15, `users`.`must_change_passwd` AS t3_r16, `users`.`passwd_changed_on` AS t3_r17, `trackers`.`id` AS t4_r0, `trackers`.`name` AS t4_r1, `trackers`.`is_in_chlog` AS t4_r2, `trackers`.`position` AS t4_r3, `trackers`.`is_in_roadmap` AS t4_r4, `trackers`.`fields_bits` AS t4_r5, `trackers`.`default_status_id` AS t4_r6, `enumerations`.`id` AS t5_r0, `enumerations`.`name` AS t5_r1, `enumerations`.`position` AS t5_r2, `enumerations`.`is_default` AS t5_r3, `enumerations`.`type` AS t5_r4, `enumerations`.`active` AS t5_r5, `enumerations`.`project_id` AS t5_r6, `enumerations`.`parent_id` AS t5_r7, `enumerations`.`position_name` AS t5_r8, `issue_categories`.`id` AS t6_r0, `issue_categories`.`project_id` AS t6_r1, `issue_categories`.`name` AS t6_r2, `issue_categories`.`assigned_to_id` AS t6_r3, `versions`.`id` AS t7_r0, `versions`.`project_id` AS t7_r1, `versions`.`name` AS t7_r2, `versions`.`description` AS t7_r3, `versions`.`effective_date` AS t7_r4, `versions`.`created_on` AS t7_r5, `versions`.`updated_on` AS t7_r6, `versions`.`wiki_page_title` AS t7_r7, `versions`.`status` AS t7_r8, `versions`.`sharing` AS t7_r9 FROM `issues` INNER JOIN `projects` ON `projects`.`id` = `issues`.`project_id` INNER JOIN `issue_statuses` ON `issue_statuses`.`id` = `issues`.`status_id` LEFT OUTER JOIN `users` ON `users`.`id` = `issues`.`assigned_to_id` LEFT OUTER JOIN `trackers` ON `trackers`.`id` = `issues`.`tracker_id` LEFT OUTER JOIN `enumerations` ON `enumerations`.`id` = `issues`.`priority_id` AND `enumerations`.`type` IN ('IssuePriority') LEFT OUTER JOIN `issue_categories` ON `issue_categories`.`id` = `issues`.`category_id` LEFT OUTER JOIN `versions` ON `versions`.`id` = `issues`.`fixed_version_id` LEFT OUTER JOIN users ON users.id = issues.assigned_to_id WHERE (projects.status <> 9 AND EXISTS (SELECT 1 AS one FROM enabled_modules em WHERE em.project_id = projects.id AND em.name='issue_tracking')) AND (((issues.status_id IS NULL OR issues.status_id NOT IN ('3'))) AND (issues.due_date <= '2018-07-27 23:59:59.999999') AND (issues.closed_on IS NULL) AND projects.id = 1) ORDER BY users.firstname ASC, users.lastname ASC, users.id ASC, issues.id ASC
/usr/local/rvm/gems/ruby-2.4.4/gems/mysql2-0.4.10/lib/mysql2/client.rb:120:in `_query'
/usr/local/rvm/gems/ruby-2.4.4/gems/mysql2-0.4.10/lib/mysql2/client.rb:120:in `block in query'
/usr/local/rvm/gems/ruby-2.4.4/gems/mysql2-0.4.10/lib/mysql2/client.rb:119:in `handle_interrupt'
/usr/local/rvm/gems/ruby-2.4.4/gems/mysql2-0.4.10/lib/mysql2/client.rb:119:in `query'
/usr/local/rvm/gems/ruby-2.4.4/gems/activerecord-4.2.8/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:309:in `block in execute'
/usr/local/rvm/gems/ruby-2.4.4/gems/activerecord-4.2.8/lib/active_record/connection_adapters/abstract_adapter.rb:484:in `block in log'
/usr/local/rvm/gems/ruby-2.4.4/gems/activesupport-4.2.8/lib/active_support/notifications/instrumenter.rb:20:in `instrument'
/usr/local/rvm/gems/ruby-2.4.4/gems/activerecord-4.2.8/lib/active_record/connection_adapters/abstract_adapter.rb:478:in `log'
/usr/local/rvm/gems/ruby-2.4.4/gems/activerecord-4.2.8/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:309:in `execute'
/usr/local/rvm/gems/ruby-2.4.4/gems/activerecord-4.2.8/lib/active_record/connection_adapters/mysql2_adapter.rb:225:in `execute'
/usr/local/rvm/gems/ruby-2.4.4/gems/activerecord-4.2.8/lib/active_record/connection_adapters/mysql2_adapter.rb:229:in `exec_query'
/usr/local/rvm/gems/ruby-2.4.4/gems/activerecord-4.2.8/lib/active_record/connection_adapters/abstract/database_statements.rb:356:in `select'
/usr/local/rvm/gems/ruby-2.4.4/gems/activerecord-4.2.8/lib/active_record/connection_adapters/abstract/database_statements.rb:32:in `select_all'
/usr/local/rvm/gems/ruby-2.4.4/gems/activerecord-4.2.8/lib/active_record/connection_adapters/abstract/query_cache.rb:70:in `select_all'
/usr/local/rvm/gems/ruby-2.4.4/gems/activerecord-4.2.8/lib/active_record/relation/finder_methods.rb:356:in `find_with_associations'
/usr/local/rvm/gems/ruby-2.4.4/gems/activerecord-4.2.8/lib/active_record/relation.rb:639:in `exec_queries'
/usr/local/rvm/gems/ruby-2.4.4/gems/activerecord-4.2.8/lib/active_record/relation.rb:515:in `load'
/usr/local/rvm/gems/ruby-2.4.4/gems/activerecord-4.2.8/lib/active_record/relation.rb:243:in `to_a'
/opt/redmine-3.4.6/app/models/issue_query.rb:293:in `issues'
/opt/redmine-3.4.6/plugins/redmine_mail_reminder/app/models/mail_reminder_mailer.rb:31:in `block in issues_reminder'
/opt/redmine-3.4.6/plugins/redmine_mail_reminder/app/models/mail_reminder_mailer.rb:29:in `issues_reminder'
/usr/local/rvm/gems/ruby-2.4.4/gems/actionpack-4.2.8/lib/abstract_controller/base.rb:198:in `process_action'
/usr/local/rvm/gems/ruby-2.4.4/gems/actionpack-4.2.8/lib/abstract_controller/callbacks.rb:20:in `block in process_action'
/usr/local/rvm/gems/ruby-2.4.4/gems/activesupport-4.2.8/lib/active_support/callbacks.rb:88:in `__run_callbacks__'
/usr/local/rvm/gems/ruby-2.4.4/gems/activesupport-4.2.8/lib/active_support/callbacks.rb:778:in `_run_process_action_callbacks'
/usr/local/rvm/gems/ruby-2.4.4/gems/activesupport-4.2.8/lib/active_support/callbacks.rb:81:in `run_callbacks'
/usr/local/rvm/gems/ruby-2.4.4/gems/actionpack-4.2.8/lib/abstract_controller/callbacks.rb:19:in `process_action'
/usr/local/rvm/gems/ruby-2.4.4/gems/actionpack-4.2.8/lib/abstract_controller/base.rb:137:in `process'
/usr/local/rvm/gems/ruby-2.4.4/gems/actionview-4.2.8/lib/action_view/rendering.rb:30:in `process'
/usr/local/rvm/gems/ruby-2.4.4/gems/actionmailer-4.2.8/lib/action_mailer/base.rb:596:in `block in process'
/usr/local/rvm/gems/ruby-2.4.4/gems/activesupport-4.2.8/lib/active_support/notifications.rb:164:in `block in instrument'
/usr/local/rvm/gems/ruby-2.4.4/gems/activesupport-4.2.8/lib/active_support/notifications/instrumenter.rb:20:in `instrument'
/usr/local/rvm/gems/ruby-2.4.4/gems/activesupport-4.2.8/lib/active_support/notifications.rb:164:in `instrument'
/usr/local/rvm/gems/ruby-2.4.4/gems/actionmailer-4.2.8/lib/action_mailer/base.rb:593:in `process'
/usr/local/rvm/gems/ruby-2.4.4/gems/actionmailer-4.2.8/lib/action_mailer/base.rb:584:in `initialize'
/usr/local/rvm/gems/ruby-2.4.4/gems/actionmailer-4.2.8/lib/action_mailer/message_delivery.rb:25:in `new'
/usr/local/rvm/gems/ruby-2.4.4/gems/actionmailer-4.2.8/lib/action_mailer/message_delivery.rb:25:in `__getobj__'
/usr/local/rvm/gems/ruby-2.4.4/gems/actionmailer-4.2.8/lib/action_mailer/message_delivery.rb:34:in `message'
/usr/local/rvm/gems/ruby-2.4.4/gems/actionmailer-4.2.8/lib/action_mailer/message_delivery.rb:85:in `deliver_now'
/opt/redmine-3.4.6/config/initializers/10-patches.rb:163:in `deliver'
/opt/redmine-3.4.6/plugins/redmine_mail_reminder/lib/tasks/reminder.rake:43:in `block (4 levels) in <top (required)>'
/opt/redmine-3.4.6/plugins/redmine_mail_reminder/lib/tasks/reminder.rake:42:in `each'
/opt/redmine-3.4.6/plugins/redmine_mail_reminder/lib/tasks/reminder.rake:42:in `block (3 levels) in <top (required)>'
/opt/redmine-3.4.6/plugins/redmine_mail_reminder/app/models/mail_reminder_mailer.rb:21:in `with_synched_deliveries'
/opt/redmine-3.4.6/plugins/redmine_mail_reminder/lib/tasks/reminder.rake:41:in `block (2 levels) in <top (required)>'
/usr/local/rvm/gems/ruby-2.4.4/gems/rake-12.3.1/exe/rake:27:in `<top (required)>'
Caused by:
Mysql2::Error: Not unique table/alias: 'users'
/usr/local/rvm/gems/ruby-2.4.4/gems/mysql2-0.4.10/lib/mysql2/client.rb:120:in `_query'
/usr/local/rvm/gems/ruby-2.4.4/gems/mysql2-0.4.10/lib/mysql2/client.rb:120:in `block in query'
/usr/local/rvm/gems/ruby-2.4.4/gems/mysql2-0.4.10/lib/mysql2/client.rb:119:in `handle_interrupt'
/usr/local/rvm/gems/ruby-2.4.4/gems/mysql2-0.4.10/lib/mysql2/client.rb:119:in `query'
/usr/local/rvm/gems/ruby-2.4.4/gems/activerecord-4.2.8/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:309:in `block in execute'
/usr/local/rvm/gems/ruby-2.4.4/gems/activerecord-4.2.8/lib/active_record/connection_adapters/abstract_adapter.rb:484:in `block in log'
/usr/local/rvm/gems/ruby-2.4.4/gems/activesupport-4.2.8/lib/active_support/notifications/instrumenter.rb:20:in `instrument'
/usr/local/rvm/gems/ruby-2.4.4/gems/activerecord-4.2.8/lib/active_record/connection_adapters/abstract_adapter.rb:478:in `log'
/usr/local/rvm/gems/ruby-2.4.4/gems/activerecord-4.2.8/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:309:in `execute'
/usr/local/rvm/gems/ruby-2.4.4/gems/activerecord-4.2.8/lib/active_record/connection_adapters/mysql2_adapter.rb:225:in `execute'
/usr/local/rvm/gems/ruby-2.4.4/gems/activerecord-4.2.8/lib/active_record/connection_adapters/mysql2_adapter.rb:229:in `exec_query'
/usr/local/rvm/gems/ruby-2.4.4/gems/activerecord-4.2.8/lib/active_record/connection_adapters/abstract/database_statements.rb:356:in `select'
/usr/local/rvm/gems/ruby-2.4.4/gems/activerecord-4.2.8/lib/active_record/connection_adapters/abstract/database_statements.rb:32:in `select_all'
/usr/local/rvm/gems/ruby-2.4.4/gems/activerecord-4.2.8/lib/active_record/connection_adapters/abstract/query_cache.rb:70:in `select_all'
/usr/local/rvm/gems/ruby-2.4.4/gems/activerecord-4.2.8/lib/active_record/relation/finder_methods.rb:356:in `find_with_associations'
/usr/local/rvm/gems/ruby-2.4.4/gems/activerecord-4.2.8/lib/active_record/relation.rb:639:in `exec_queries'
/usr/local/rvm/gems/ruby-2.4.4/gems/activerecord-4.2.8/lib/active_record/relation.rb:515:in `load'
/usr/local/rvm/gems/ruby-2.4.4/gems/activerecord-4.2.8/lib/active_record/relation.rb:243:in `to_a'
/opt/redmine-3.4.6/app/models/issue_query.rb:293:in `issues'
/opt/redmine-3.4.6/plugins/redmine_mail_reminder/app/models/mail_reminder_mailer.rb:31:in `block in issues_reminder'
/opt/redmine-3.4.6/plugins/redmine_mail_reminder/app/models/mail_reminder_mailer.rb:29:in `issues_reminder'
/usr/local/rvm/gems/ruby-2.4.4/gems/actionpack-4.2.8/lib/abstract_controller/base.rb:198:in `process_action'
/usr/local/rvm/gems/ruby-2.4.4/gems/actionpack-4.2.8/lib/abstract_controller/callbacks.rb:20:in `block in process_action'
/usr/local/rvm/gems/ruby-2.4.4/gems/activesupport-4.2.8/lib/active_support/callbacks.rb:88:in `__run_callbacks__'
/usr/local/rvm/gems/ruby-2.4.4/gems/activesupport-4.2.8/lib/active_support/callbacks.rb:778:in `_run_process_action_callbacks'
/usr/local/rvm/gems/ruby-2.4.4/gems/activesupport-4.2.8/lib/active_support/callbacks.rb:81:in `run_callbacks'
/usr/local/rvm/gems/ruby-2.4.4/gems/actionpack-4.2.8/lib/abstract_controller/callbacks.rb:19:in `process_action'
/usr/local/rvm/gems/ruby-2.4.4/gems/actionpack-4.2.8/lib/abstract_controller/base.rb:137:in `process'
/usr/local/rvm/gems/ruby-2.4.4/gems/actionview-4.2.8/lib/action_view/rendering.rb:30:in `process'
/usr/local/rvm/gems/ruby-2.4.4/gems/actionmailer-4.2.8/lib/action_mailer/base.rb:596:in `block in process'
/usr/local/rvm/gems/ruby-2.4.4/gems/activesupport-4.2.8/lib/active_support/notifications.rb:164:in `block in instrument'
/usr/local/rvm/gems/ruby-2.4.4/gems/activesupport-4.2.8/lib/active_support/notifications/instrumenter.rb:20:in `instrument'
/usr/local/rvm/gems/ruby-2.4.4/gems/activesupport-4.2.8/lib/active_support/notifications.rb:164:in `instrument'
/usr/local/rvm/gems/ruby-2.4.4/gems/actionmailer-4.2.8/lib/action_mailer/base.rb:593:in `process'
/usr/local/rvm/gems/ruby-2.4.4/gems/actionmailer-4.2.8/lib/action_mailer/base.rb:584:in `initialize'
/usr/local/rvm/gems/ruby-2.4.4/gems/actionmailer-4.2.8/lib/action_mailer/message_delivery.rb:25:in `new'
/usr/local/rvm/gems/ruby-2.4.4/gems/actionmailer-4.2.8/lib/action_mailer/message_delivery.rb:25:in `__getobj__'
/usr/local/rvm/gems/ruby-2.4.4/gems/actionmailer-4.2.8/lib/action_mailer/message_delivery.rb:34:in `message'
/usr/local/rvm/gems/ruby-2.4.4/gems/actionmailer-4.2.8/lib/action_mailer/message_delivery.rb:85:in `deliver_now'
/opt/redmine-3.4.6/config/initializers/10-patches.rb:163:in `deliver'
/opt/redmine-3.4.6/plugins/redmine_mail_reminder/lib/tasks/reminder.rake:43:in `block (4 levels) in <top (required)>'
/opt/redmine-3.4.6/plugins/redmine_mail_reminder/lib/tasks/reminder.rake:42:in `each'
/opt/redmine-3.4.6/plugins/redmine_mail_reminder/lib/tasks/reminder.rake:42:in `block (3 levels) in <top (required)>'
/opt/redmine-3.4.6/plugins/redmine_mail_reminder/app/models/mail_reminder_mailer.rb:21:in `with_synched_deliveries'
/opt/redmine-3.4.6/plugins/redmine_mail_reminder/lib/tasks/reminder.rake:41:in `block (2 levels) in <top (required)>'
/usr/local/rvm/gems/ruby-2.4.4/gems/rake-12.3.1/exe/rake:27:in `<top (required)>'
Tasks: TOP => reminder:exec
(See full trace by running task with --trace)
Any help on this error?
I also got this with 3.4 - my trace looks like:
$ rake reminder:exec[test] RAILS_ENV="production" Project "PMC" with query "Failed Devices" is forced processing under [test] mode. rake aborted! Query::StatementInvalid: Mysql2::Error: Not unique table/alias: 'enumerations': SELECT `issues`.`id` AS t0_r0, `issues`.`tracker_id` AS t0_r1, `issues`.`project_id` AS t0_r2, `issues`.`subject` AS t0_r3, `issues`.`description` AS t0_r4, `issues`.`due_date` AS t0_r5, `issues`.`category_id` AS t0_r6, `issues`.`status_id` AS t0_r7, `issues`.`assigned_to_id` AS t0_r8, `issues`.`priority_id` AS t0_r9, `issues`.`fixed_version_id` AS t0_r10, `issues`.`author_id` AS t0_r11, `issues`.`lock_version` AS t0_r12, `issues`.`created_on` AS t0_r13, `issues`.`updated_on` AS t0_r14, `issues`.`start_date` AS t0_r15, `issues`.`done_ratio` AS t0_r16, `issues`.`estimated_hours` AS t0_r17, `issues`.`parent_id` AS t0_r18, `issues`.`root_id` AS t0_r19, `issues`.`lft` AS t0_r20, `issues`.`rgt` AS t0_r21, `issues`.`is_private` AS t0_r22, `issues`.`closed_on` AS t0_r23, `issue_statuses`.`id` AS t1_r0, `issue_statuses`.`name` AS t1_r1, `issue_statuses`.`is_closed` AS t1_r2, `issue_statuses`.`position` AS t1_r3, `issue_statuses`.`default_done_ratio` AS t1_r4, `projects`.`id` AS t2_r0, `projects`.`name` AS t2_r1, `projects`.`description` AS t2_r2, `projects`.`homepage` AS t2_r3, `projects`.`is_public` AS t2_r4, `projects`.`parent_id` AS t2_r5, `projects`.`created_on` AS t2_r6, `projects`.`updated_on` AS t2_r7, `projects`.`identifier` AS t2_r8, `projects`.`status` AS t2_r9, `projects`.`lft` AS t2_r10, `projects`.`rgt` AS t2_r11, `projects`.`inherit_members` AS t2_r12, `projects`.`default_version_id` AS t2_r13, `projects`.`dmsf_description` AS t2_r14, `projects`.`dmsf_notification` AS t2_r15, `projects`.`default_assigned_to_id` AS t2_r16, `projects`.`dmsf_act_as_attachable` AS t2_r17, `users`.`id` AS t3_r0, `users`.`login` AS t3_r1, `users`.`hashed_password` AS t3_r2, `users`.`firstname` AS t3_r3, `users`.`lastname` AS t3_r4, `users`.`admin` AS t3_r5, `users`.`status` AS t3_r6, `users`.`last_login_on` AS t3_r7, `users`.`language` AS t3_r8, `users`.`auth_source_id` AS t3_r9, `users`.`created_on` AS t3_r10, `users`.`updated_on` AS t3_r11, `users`.`type` AS t3_r12, `users`.`identity_url` AS t3_r13, `users`.`mail_notification` AS t3_r14, `users`.`salt` AS t3_r15, `users`.`must_change_passwd` AS t3_r16, `users`.`passwd_changed_on` AS t3_r17, `trackers`.`id` AS t4_r0, `trackers`.`name` AS t4_r1, `trackers`.`is_in_chlog` AS t4_r2, `trackers`.`position` AS t4_r3, `trackers`.`is_in_roadmap` AS t4_r4, `trackers`.`fields_bits` AS t4_r5, `trackers`.`default_status_id` AS t4_r6, `enumerations`.`id` AS t5_r0, `enumerations`.`name` AS t5_r1, `enumerations`.`position` AS t5_r2, `enumerations`.`is_default` AS t5_r3, `enumerations`.`type` AS t5_r4, `enumerations`.`active` AS t5_r5, `enumerations`.`project_id` AS t5_r6, `enumerations`.`parent_id` AS t5_r7, `enumerations`.`position_name` AS t5_r8, `issue_categories`.`id` AS t6_r0, `issue_categories`.`project_id` AS t6_r1, `issue_categories`.`name` AS t6_r2, `issue_categories`.`assigned_to_id` AS t6_r3, `versions`.`id` AS t7_r0, `versions`.`project_id` AS t7_r1, `versions`.`name` AS t7_r2, `versions`.`description` AS t7_r3, `versions`.`effective_date` AS t7_r4, `versions`.`created_on` AS t7_r5, `versions`.`updated_on` AS t7_r6, `versions`.`wiki_page_title` AS t7_r7, `versions`.`status` AS t7_r8, `versions`.`sharing` AS t7_r9 FROM `issues` INNER JOIN `projects` ON `projects`.`id` = `issues`.`project_id` INNER JOIN `issue_statuses` ON `issue_statuses`.`id` = `issues`.`status_id` LEFT OUTER JOIN `users` ON `users`.`id` = `issues`.`assigned_to_id` LEFT OUTER JOIN `trackers` ON `trackers`.`id` = `issues`.`tracker_id` LEFT OUTER JOIN `enumerations` ON `enumerations`.`id` = `issues`.`priority_id` AND `enumerations`.`type` IN ('IssuePriority') LEFT OUTER JOIN `issue_categories` ON `issue_categories`.`id` = `issues`.`category_id` LEFT OUTER JOIN `versions` ON `versions`.`id` = `issues`.`fixed_version_id` LEFT OUTER JOIN custom_values cf_4 ON cf_4.customized_type = 'Issue' AND cf_4.customized_id = issues.id AND cf_4.custom_field_id = 4 AND (((1=1) AND (issues.tracker_id IN (SELECT tracker_id FROM custom_fields_trackers WHERE custom_field_id = 4)) AND (EXISTS (SELECT 1 FROM custom_fields ifa WHERE ifa.is_for_all = 1 AND ifa.id = 4) OR issues.project_id IN (SELECT project_id FROM custom_fields_projects WHERE custom_field_id = 4)))) AND cf_4.value <> '' AND cf_4.id = (SELECT max(cf_4_2.id) FROM custom_values cf_4_2 WHERE cf_4_2.customized_type = cf_4.customized_type AND cf_4_2.customized_id = cf_4.customized_id AND cf_4_2.custom_field_id = cf_4.custom_field_id) LEFT OUTER JOIN enumerations ON enumerations.id = issues.priority_id WHERE (projects.status <> 9 AND EXISTS (SELECT 1 AS one FROM enabled_modules em WHERE em.project_id = projects.id AND em.name='issue_tracking')) AND ((issues.status_id IN (SELECT id FROM issue_statuses WHERE is_closed=0)) AND (issues.tracker_id IN ('15')) AND (issues.assigned_to_id IN ('12')) AND projects.id = 5) ORDER BY projects.name ASC, enumerations.position DESC, issues.created_on ASC, COALESCE(cf_4.value, '') DESC /usr/local/www/redmine/app/models/issue_query.rb:312:in `rescue in issues' /usr/local/www/redmine/app/models/issue_query.rb:274:in `issues' /usr/local/www/redmine/plugins/redmine_mail_reminder/app/models/mail_reminder_mailer.rb:31:in `block in issues_reminder' /usr/local/www/redmine/plugins/redmine_mail_reminder/app/models/mail_reminder_mailer.rb:29:in `issues_reminder' /usr/local/www/redmine/config/initializers/10-patches.rb:163:in `deliver' /usr/local/www/redmine/plugins/redmine_mail_reminder/lib/tasks/reminder.rake:43:in `block (4 levels) in' /usr/local/www/redmine/plugins/redmine_mail_reminder/lib/tasks/reminder.rake:42:in `each' /usr/local/www/redmine/plugins/redmine_mail_reminder/lib/tasks/reminder.rake:42:in `block (3 levels) in ' /usr/local/www/redmine/plugins/redmine_mail_reminder/app/models/mail_reminder_mailer.rb:21:in `with_synched_deliveries' /usr/local/www/redmine/plugins/redmine_mail_reminder/lib/tasks/reminder.rake:41:in `block (2 levels) in ' Caused by: ActiveRecord::StatementInvalid: Mysql2::Error: Not unique table/alias: 'enumerations': SELECT `issues`.`id` AS t0_r0, `issues`.`tracker_id` AS t0_r1, `issues`.`project_id` AS t0_r2, `issues`.`subject` AS t0_r3, `issues`.`description` AS t0_r4, `issues`.`due_date` AS t0_r5, `issues`.`category_id` AS t0_r6, `issues`.`status_id` AS t0_r7, `issues`.`assigned_to_id` AS t0_r8, `issues`.`priority_id` AS t0_r9, `issues`.`fixed_version_id` AS t0_r10, `issues`.`author_id` AS t0_r11, `issues`.`lock_version` AS t0_r12, `issues`.`created_on` AS t0_r13, `issues`.`updated_on` AS t0_r14, `issues`.`start_date` AS t0_r15, `issues`.`done_ratio` AS t0_r16, `issues`.`estimated_hours` AS t0_r17, `issues`.`parent_id` AS t0_r18, `issues`.`root_id` AS t0_r19, `issues`.`lft` AS t0_r20, `issues`.`rgt` AS t0_r21, `issues`.`is_private` AS t0_r22, `issues`.`closed_on` AS t0_r23, `issue_statuses`.`id` AS t1_r0, `issue_statuses`.`name` AS t1_r1, `issue_statuses`.`is_closed` AS t1_r2, `issue_statuses`.`position` AS t1_r3, `issue_statuses`.`default_done_ratio` AS t1_r4, `projects`.`id` AS t2_r0, `projects`.`name` AS t2_r1, `projects`.`description` AS t2_r2, `projects`.`homepage` AS t2_r3, `projects`.`is_public` AS t2_r4, `projects`.`parent_id` AS t2_r5, `projects`.`created_on` AS t2_r6, `projects`.`updated_on` AS t2_r7, `projects`.`identifier` AS t2_r8, `projects`.`status` AS t2_r9, `projects`.`lft` AS t2_r10, `projects`.`rgt` AS t2_r11, `projects`.`inherit_members` AS t2_r12, `projects`.`default_version_id` AS t2_r13, `projects`.`dmsf_description` AS t2_r14, `projects`.`dmsf_notification` AS t2_r15, `projects`.`default_assigned_to_id` AS t2_r16, `projects`.`dmsf_act_as_attachable` AS t2_r17, `users`.`id` AS t3_r0, `users`.`login` AS t3_r1, `users`.`hashed_password` AS t3_r2, `users`.`firstname` AS t3_r3, `users`.`lastname` AS t3_r4, `users`.`admin` AS t3_r5, `users`.`status` AS t3_r6, `users`.`last_login_on` AS t3_r7, `users`.`language` AS t3_r8, `users`.`auth_source_id` AS t3_r9, `users`.`created_on` AS t3_r10, `users`.`updated_on` AS t3_r11, `users`.`type` AS t3_r12, `users`.`identity_url` AS t3_r13, `users`.`mail_notification` AS t3_r14, `users`.`salt` AS t3_r15, `users`.`must_change_passwd` AS t3_r16, `users`.`passwd_changed_on` AS t3_r17, `trackers`.`id` AS t4_r0, `trackers`.`name` AS t4_r1, `trackers`.`is_in_chlog` AS t4_r2, `trackers`.`position` AS t4_r3, `trackers`.`is_in_roadmap` AS t4_r4, `trackers`.`fields_bits` AS t4_r5, `trackers`.`default_status_id` AS t4_r6, `enumerations`.`id` AS t5_r0, `enumerations`.`name` AS t5_r1, `enumerations`.`position` AS t5_r2, `enumerations`.`is_default` AS t5_r3, `enumerations`.`type` AS t5_r4, `enumerations`.`active` AS t5_r5, `enumerations`.`project_id` AS t5_r6, `enumerations`.`parent_id` AS t5_r7, `enumerations`.`position_name` AS t5_r8, `issue_categories`.`id` AS t6_r0, `issue_categories`.`project_id` AS t6_r1, `issue_categories`.`name` AS t6_r2, `issue_categories`.`assigned_to_id` AS t6_r3, `versions`.`id` AS t7_r0, `versions`.`project_id` AS t7_r1, `versions`.`name` AS t7_r2, `versions`.`description` AS t7_r3, `versions`.`effective_date` AS t7_r4, `versions`.`created_on` AS t7_r5, `versions`.`updated_on` AS t7_r6, `versions`.`wiki_page_title` AS t7_r7, `versions`.`status` AS t7_r8, `versions`.`sharing` AS t7_r9 FROM `issues` INNER JOIN `projects` ON `projects`.`id` = `issues`.`project_id` INNER JOIN `issue_statuses` ON `issue_statuses`.`id` = `issues`.`status_id` LEFT OUTER JOIN `users` ON `users`.`id` = `issues`.`assigned_to_id` LEFT OUTER JOIN `trackers` ON `trackers`.`id` = `issues`.`tracker_id` LEFT OUTER JOIN `enumerations` ON `enumerations`.`id` = `issues`.`priority_id` AND `enumerations`.`type` IN ('IssuePriority') LEFT OUTER JOIN `issue_categories` ON `issue_categories`.`id` = `issues`.`category_id` LEFT OUTER JOIN `versions` ON `versions`.`id` = `issues`.`fixed_version_id` LEFT OUTER JOIN custom_values cf_4 ON cf_4.customized_type = 'Issue' AND cf_4.customized_id = issues.id AND cf_4.custom_field_id = 4 AND (((1=1) AND (issues.tracker_id IN (SELECT tracker_id FROM custom_fields_trackers WHERE custom_field_id = 4)) AND (EXISTS (SELECT 1 FROM custom_fields ifa WHERE ifa.is_for_all = 1 AND ifa.id = 4) OR issues.project_id IN (SELECT project_id FROM custom_fields_projects WHERE custom_field_id = 4)))) AND cf_4.value <> '' AND cf_4.id = (SELECT max(cf_4_2.id) FROM custom_values cf_4_2 WHERE cf_4_2.customized_type = cf_4.customized_type AND cf_4_2.customized_id = cf_4.customized_id AND cf_4_2.custom_field_id = cf_4.custom_field_id) LEFT OUTER JOIN enumerations ON enumerations.id = issues.priority_id WHERE (projects.status <> 9 AND EXISTS (SELECT 1 AS one FROM enabled_modules em WHERE em.project_id = projects.id AND em.name='issue_tracking')) AND ((issues.status_id IN (SELECT id FROM issue_statuses WHERE is_closed=0)) AND (issues.tracker_id IN ('15')) AND (issues.assigned_to_id IN ('12')) AND projects.id = 5) ORDER BY projects.name ASC, enumerations.position DESC, issues.created_on ASC, COALESCE(cf_4.value, '') DESC /usr/local/www/redmine/app/models/issue_query.rb:293:in `issues' /usr/local/www/redmine/plugins/redmine_mail_reminder/app/models/mail_reminder_mailer.rb:31:in `block in issues_reminder' /usr/local/www/redmine/plugins/redmine_mail_reminder/app/models/mail_reminder_mailer.rb:29:in `issues_reminder' /usr/local/www/redmine/config/initializers/10-patches.rb:163:in `deliver' /usr/local/www/redmine/plugins/redmine_mail_reminder/lib/tasks/reminder.rake:43:in `block (4 levels) in ' /usr/local/www/redmine/plugins/redmine_mail_reminder/lib/tasks/reminder.rake:42:in `each' /usr/local/www/redmine/plugins/redmine_mail_reminder/lib/tasks/reminder.rake:42:in `block (3 levels) in ' /usr/local/www/redmine/plugins/redmine_mail_reminder/app/models/mail_reminder_mailer.rb:21:in `with_synched_deliveries' /usr/local/www/redmine/plugins/redmine_mail_reminder/lib/tasks/reminder.rake:41:in `block (2 levels) in ' Caused by: Mysql2::Error: Not unique table/alias: 'enumerations' /usr/local/www/redmine/app/models/issue_query.rb:293:in `issues' /usr/local/www/redmine/plugins/redmine_mail_reminder/app/models/mail_reminder_mailer.rb:31:in `block in issues_reminder' /usr/local/www/redmine/plugins/redmine_mail_reminder/app/models/mail_reminder_mailer.rb:29:in `issues_reminder' /usr/local/www/redmine/config/initializers/10-patches.rb:163:in `deliver' /usr/local/www/redmine/plugins/redmine_mail_reminder/lib/tasks/reminder.rake:43:in `block (4 levels) in ' /usr/local/www/redmine/plugins/redmine_mail_reminder/lib/tasks/reminder.rake:42:in `each' /usr/local/www/redmine/plugins/redmine_mail_reminder/lib/tasks/reminder.rake:42:in `block (3 levels) in ' /usr/local/www/redmine/plugins/redmine_mail_reminder/app/models/mail_reminder_mailer.rb:21:in `with_synched_deliveries' /usr/local/www/redmine/plugins/redmine_mail_reminder/lib/tasks/reminder.rake:41:in `block (2 levels) in ' Tasks: TOP => reminder:exec (See full trace by running task with --trace)
I have the same issue. Are you planning a fixed or plugin is dead? Regards.
The same issue here.
I updated plugin to new version (last commit 1c88239) When I run
cd /usr/share/redmine/ && ./bin/rake reminder:exec[test] RAILS_ENV="production"
I got the error
How can I fix it?
Thank you