Project

General

Profile

Actions

Defect #35115

closed

Time entries are broken if grouped by project and issue custom fields

Added by Alexander Meindl about 2 years ago. Updated about 2 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Custom fields
Target version:
Start date:
Due date:
% Done:

0%

Estimated time:
Resolution:
Fixed
Affected version:

Description

If you have a custom field for project, which can be used for group by filter (e.g. a list format).

If you try to use this custom fields for group by on time entries this throw an exception:

Query::StatementInvalid: Mysql2::Error: Unknown column 'cf_14.value' in 'field list': SELECT COUNT(DISTINCT `time_entries`.`id`) AS count_

This error occurs on project scope and without project scope.

What I found out, till now:

  • this is new with Redmine 4.2
  • with earlier Redmine versions, you cannot select a group by field from other entities implementation

I see the following solutions:

  • allow group by on custom fields from other entities and this error (it looks like the join to custom field is missing)
  • do not offer group by fields of custom fields from other entities

My test environment:

  • Redmine 4.2.0
  • Ruby 2.7.3
  • PostgreSQL 13
  • No plugin

Files


Related issues

Related to Redmine - Defect #33290: Unnecessary database access when IssueQuery class is definedClosedGo MAEDA

Actions
Actions #1

Updated by Alexander Meindl about 2 years ago

Same problem with MySQL, but the problem should the same with all database types.

Actions #2

Updated by Marius BALTEANU about 2 years ago

  • Status changed from New to Confirmed
  • Assignee set to Marius BALTEANU
  • Target version set to 4.2.1
Actions #3

Updated by xi won about 2 years ago

  • File 193333990[1].zip added
Actions #4

Updated by Marius BALTEANU about 2 years ago

  • File deleted (193333990[1].zip)
Actions #5

Updated by Marius BALTEANU about 2 years ago

Before r20830, project custom fields were not groupable in associations and this is way this issue was not presented in earlier versions.

Actions #6

Updated by Marius BALTEANU about 2 years ago

For 4.2.1, we should restore the old behaviour, I've attached a fix.

Alexander, thanks for reporting this issue. Regarding allow group by on custom fields from other entities, please open a new issue for this and if you have an working patch to implement this, I will be happy to review it for 5.0.0.

Actions #7

Updated by Go MAEDA about 2 years ago

  • Related to Defect #33290: Unnecessary database access when IssueQuery class is defined added
Actions #8

Updated by Go MAEDA about 2 years ago

  • Status changed from Confirmed to Closed
  • Assignee set to Go MAEDA
  • Resolution set to Fixed

Committed the fix. Thank you.

Actions

Also available in: Atom PDF