Fix order of GREATEST for Oracle

As per https://docs.oracle.com/cd/B19306_01/server.102/b14200/functions060.htm
Oracle uses the first value to cast the rest or the values.
So when the first value is a plain int, instead of doing the math,
it will cast the expression to int and continue with a potential 0.

Signed-off-by: Joas Schilling <coding@schilljs.com>
This commit is contained in:
Joas Schilling 2020-11-04 17:02:23 +01:00 committed by backportbot[bot]
parent 71de05f775
commit d111e88d4c
1 changed files with 3 additions and 3 deletions

View File

@ -104,9 +104,9 @@ class Propagator implements IPropagator {
$builder = $this->connection->getQueryBuilder();
$builder->update('filecache')
->set('size', $builder->func()->greatest(
$builder->createNamedParameter(-1, IQueryBuilder::PARAM_INT),
$builder->func()->add('size', $builder->createNamedParameter($sizeDifference)))
)
$builder->func()->add('size', $builder->createNamedParameter($sizeDifference)),
$builder->createNamedParameter(-1, IQueryBuilder::PARAM_INT)
))
->where($builder->expr()->eq('storage', $builder->createNamedParameter($storageId, IQueryBuilder::PARAM_INT)))
->andWhere($builder->expr()->in('path_hash', $hashParams))
->andWhere($builder->expr()->gt('size', $builder->expr()->literal(-1, IQueryBuilder::PARAM_INT)));