IdoQuery: Lowercase subquery ci filters on postgres

fixes #4178
This commit is contained in:
Johannes Meyer 2020-06-16 09:59:19 +02:00
parent 1979b53555
commit 4505e29ce3
1 changed files with 8 additions and 1 deletions

View File

@ -568,6 +568,13 @@ abstract class IdoQuery extends DbQuery
$and = false; $and = false;
} }
$alias = $filter->getColumn();
$column = $subQuery->aliasToColumnName($alias);
if (isset($this->caseInsensitiveColumns[$subQuery->aliasToTableName($alias)][$alias])) {
$column = 'LOWER( ' . $column . ' )';
$subQueryFilter->setExpression(array_map('strtolower', $subQueryFilter->getExpression()));
}
$additional = null; $additional = null;
list($theirs, $ours) = $this->joinSubQuery($subQuery, $queryName, $subQueryFilter, $and, $negate, $additional); list($theirs, $ours) = $this->joinSubQuery($subQuery, $queryName, $subQueryFilter, $and, $negate, $additional);
@ -620,7 +627,7 @@ abstract class IdoQuery extends DbQuery
$subQueryFilter->setColumn(preg_replace( $subQueryFilter->setColumn(preg_replace(
'/(?<=^|\s)\w+(?=\.)/', '/(?<=^|\s)\w+(?=\.)/',
'sub_$0', 'sub_$0',
$subQuery->aliasToColumnName($filter->getColumn()) $column
)); ));
if ($negate) { if ($negate) {