]> source.dussan.org Git - nextcloud-server.git/commitdiff
Don't use SELECT DISTINCT when to_char() is used in a WHERE statement 22469/head
authorJoas Schilling <coding@schilljs.com>
Fri, 28 Aug 2020 06:57:06 +0000 (08:57 +0200)
committerJoas Schilling <coding@schilljs.com>
Mon, 7 Sep 2020 13:17:48 +0000 (15:17 +0200)
Nice bug in Oracle

Signed-off-by: Joas Schilling <coding@schilljs.com>
apps/workflowengine/lib/Manager.php

index b583b19007043fdddce5f72dcdd77b3458898686..fefeb9230e66422f1ed00e5ec2afae5ee09918dc 100644 (file)
@@ -147,10 +147,10 @@ class Manager implements IManager {
        public function getAllConfiguredEvents() {
                $query = $this->connection->getQueryBuilder();
 
-               $query->selectDistinct('class')
-                       ->addSelect('entity', 'events')
+               $query->select('class', 'entity', $query->expr()->castColumn('events', IQueryBuilder::PARAM_STR))
                        ->from('flow_operations')
-                       ->where($query->expr()->neq('events', $query->createNamedParameter('[]'), IQueryBuilder::PARAM_STR));
+                       ->where($query->expr()->neq('events', $query->createNamedParameter('[]'), IQueryBuilder::PARAM_STR))
+                       ->groupBy('class', 'entity', $query->expr()->castColumn('events', IQueryBuilder::PARAM_STR));
 
                $result = $query->execute();
                $operations = [];