Review 12.4 Merged

81435[BUGFIX] Provide CSP ReportRepository ONLY_FULL_GROUP_BY support

Oliver Hader CR +2 V +2 Normal +165 −28 updated 10/16/23, 11:06

Commit message

Some database systems like PostgresSQL and MySQL are really
picky if selected columns are not contained in all group and
order selections or no aggregation method is used
(aka 'ONLY_FULL_GROUP_BY').

That may be influenced by server configuration, which makes
it really hard to come up with a minmal grouping query if:

* not all used `ORDER BY` fields are included in
  the `GROUP BY` selection
* not all `GROUP BY` fields are contained in the
  `SELECT` field list
* Fields in the `SELECT` list are not included in
  the `GROUP BY` list OR using a aggregation function
  like `MAX()`, `MIN()`, `AVG(), `SUM()` and similar.

Aggregation function cannot be used for non numeric values like
`uuid like` strings and prevent to group on a field but retrieve
the uinique id (UUID, uid, ) of the `first` or  `last` record per
group in on query.

To get a similar effect through all database vendor and without
requiring specific, mostly not default database settings provided
by many hosting provider or in default configuration for databases,
this change introduces a nested inner join construct with to ensure
the same result across multiple systems.

Review

  • Code review CR +2

    Imported before Forger kept the single votes, the next import adds them.

  • Verified V +2

    Imported before Forger kept the single votes, the next import adds them.

Issues 1

Files 4