Defect #35115

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

Added by Alexander Meindl 5 months ago. Updated 5 months ago.

Status:ClosedStart date:
Priority:NormalDue date:
Assignee:Go MAEDA% Done:

0%

Category:Custom fields
Target version:4.2.1
Resolution:Fixed Affected version:4.2.0

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

0001-Disable-grouping-for-associations-custom-field.patch Magnifier (1.19 KB) Marius BALTEANU, 2021-04-19 22:25


Related issues

Related to Redmine - Defect #33290: Unnecessary database access when IssueQuery class is defined Closed

Associated revisions

Revision 20956
Added by Go MAEDA 5 months ago

Disable grouping for associations custom field (#35115).

Patch by Marius BALTEANU.

Revision 20957
Added by Go MAEDA 5 months ago

Merged r20956 from trunk to 4.2-stable (#35115).

History

#1 Updated by Alexander Meindl 5 months ago

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

#2 Updated by Marius BALTEANU 5 months ago

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

#3 Updated by xi won 5 months ago

  • File 193333990[1].zip added

#4 Updated by Marius BALTEANU 5 months ago

  • File deleted (193333990[1].zip)

#5 Updated by Marius BALTEANU 5 months ago

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

#6 Updated by Marius BALTEANU 5 months 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.

#7 Updated by Go MAEDA 5 months ago

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

#8 Updated by Go MAEDA 5 months ago

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

Committed the fix. Thank you.

Also available in: Atom PDF