Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

use MIN instead of ANY_VALUE, as latter is available only in PostgreSQL 16

Ivan Kuchinae6702adefae
diff --git a/app/models/custom_field/order_statements.rb b/app/models/custom_field/order_statements.rb
index a6a5062497a..464f3ed6b15 100644
--- a/app/models/custom_field/order_statements.rb
+++ b/app/models/custom_field/order_statements.rb
@@ -75,7 +75,9 @@ module CustomField::OrderStatements
def group_by_select_statement
return unless field_format == "list"
- "ANY_VALUE(cf_order_#{id}.ids)"
+ # MIN needed to not add this column to group by, ANY_VALUE can be used when
+ # minimum required PostgreSQL becomes 16
+ "MIN(cf_order_#{id}.ids)"
end
# Returns the join statement that is required to group objects by their value