Defect #33224

SQL Server: A column has been specified more than once

Added by Pavel Rosický 8 months ago. Updated 8 months ago.

Status:ClosedStart date:
Priority:NormalDue date:
Assignee:-% Done:

0%

Category:Database
Target version:-
Resolution:Duplicate Affected version:

Description

there seems to be a new failure on master

Error:
Redmine::Helpers::GanttHelperTest#test_#subject_for_issue_should_style_overdue_issues:
Query::StatementInvalid: TinyTds::Error: A column has been specified more than once in the order by list. Columns in the order by list must be unique.: EXEC sp_executesql N'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].[default_assigned_to_id] AS t2_r14, [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, [trackers].[description] AS t4_r7, [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 (N''IssuePriority'') LEFT OUTER JOIN [issue_categories] ON [issue_categories].[id] = [issues].[category_id] LEFT OUTER JOIN [versions] ON [versions].[id] = [issues].[fixed_version_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 projects.id = 146)  ORDER BY projects.lft ASC, issues.id ASC, issues.id DESC OFFSET 0 ROWS FETCH NEXT @0 ROWS ONLY', N'@0 int', @0 = 500
    app/models/issue_query.rb:360:in `rescue in issues'
    app/models/issue_query.rb:318:in `issues'
    lib/redmine/helpers/gantt.rb:152:in `issues'
    lib/redmine/helpers/gantt.rb:192:in `project_issues'
    lib/redmine/helpers/gantt.rb:755:in `html_subject'
    lib/redmine/helpers/gantt.rb:352:in `subject'
    lib/redmine/helpers/gantt.rb:325:in `subject_for_issue'
    test/unit/lib/redmine/helpers/gantt_test.rb:306:in `block in <class:GanttHelperTest>'

as you can see, the query is sorted by issues.id ASC and issues.id DESC which doesn't make much sense

Environment:
r19626

  Redmine version                4.1.0.devel
  Ruby version                   2.5.1-p57 (2018-03-29) [x64-mingw32]
  Rails version                  5.2.4.2
  Environment                    production
  Database adapter               SQLServer
  Mailer queue                   ActiveJob::QueueAdapters::AsyncAdapter
  Mailer delivery                smtp
SCM:
  Git                            2.23.0
  Filesystem
Redmine plugins:
  no plugin installed

related #30285


Related issues

Duplicates Redmine - Defect #32737: Duplicate sort keys for issue query cause SQL error with ... Closed

History

#1 Updated by Marius BALTEANU 8 months ago

Is not the same issue from #32737?

#2 Updated by Pavel Rosický 8 months ago

ahh sry, it is a duplicate.

#3 Updated by Marius BALTEANU 8 months ago

  • Duplicates Defect #32737: Duplicate sort keys for issue query cause SQL error with SQL Server added

#4 Updated by Marius BALTEANU 8 months ago

  • Status changed from New to Closed
  • Resolution set to Duplicate

Pavel Rosický wrote:

ahh sry, it is a duplicate.

Don't worry, thanks for your quick response.

Also available in: Atom PDF