Project

General

Profile

Actions

Bug #103961

closed

Postgres: Extbase LIKE query is case sensitive

Added by Andreas Kießling 6 months ago. Updated 5 months ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
Extbase
Target version:
-
Start date:
2024-05-31
Due date:
% Done:

100%

Estimated time:
TYPO3 Version:
12
PHP Version:
8.3
Tags:
Complexity:
Is Regression:
Sprint Focus:

Description

While updating a pretty old site to 12.4 i stumbled up on a like query that is now executed case sensitive.
Similar to #98570 --> \TYPO3\CMS\Extbase\Persistence\Generic\Storage\Typo3DbQueryParser::parseDynamicOperand

Kind of ugly to patch that in there, but seems to do the job.

case QueryInterface::OPERATOR_LIKE:
    $placeHolder = $this->createTypedNamedParameter($value, Connection::PARAM_STR);
    $platform = $this->queryBuilder->getConnection()->getDatabasePlatform();
    if ($platform instanceof \Doctrine\DBAL\Platforms\PostgreSQLPlatform) {
        $expr = $exprBuilder->comparison($fieldName, 'ILIKE', $placeHolder);
    } else {
        $expr = $exprBuilder->comparison($fieldName, 'LIKE', $placeHolder);
    }
    break;

It seems that the old adodb/dbal setup automatically used ILIKE for Postgres

if ($isLikeOperator && $functionMapping) {
    if ($this->databaseConnection->runningADOdbDriver('postgres') || $this->databaseConnection->runningADOdbDriver('postgres64') || $this->databaseConnection->runningADOdbDriver('postgres7') || $this->databaseConnection->runningADOdbDriver('postgres8')) {
        // Remap (NOT)? LIKE to (NOT)? ILIKE
        // and (NOT)? LIKE BINARY to (NOT)? LIKE
        switch ($v['comparator']) {
            case 'LIKE':
                $v['comparator'] = 'ILIKE';
                break;
            case 'NOT LIKE':
                $v['comparator'] = 'NOT ILIKE';
                break;
            default:

Maybe the old behavior should be restored? I'm fine with having my instance patched though if you'd like to stick to the defaults


Related issues 1 (1 open0 closed)

Related to TYPO3 Core - Epic #90719: PostgreSQL related issuesAccepted2020-03-10

Actions
Actions

Also available in: Atom PDF