Project

General

Profile

Actions

Bug #103961

closed

Postgres: Extbase LIKE query is case sensitive

Added by Andreas Kießling about 2 months ago. Updated 8 days 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 #1

Updated by Andreas Kießling about 2 months ago

  • Related to Epic #90719: PostgreSQL related issues added
Actions #2

Updated by Gerrit Code Review about 2 months ago

  • Status changed from New to Under Review

Patch set 1 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/84451

Actions #3

Updated by Gerrit Code Review about 1 month ago

Patch set 2 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/84451

Actions #4

Updated by Gerrit Code Review about 1 month ago

Patch set 3 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/84451

Actions #5

Updated by Gerrit Code Review about 1 month ago

Patch set 4 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/84451

Actions #6

Updated by Gerrit Code Review about 1 month ago

Patch set 1 for branch 12.4 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/84534

Actions #7

Updated by Georg Ringer about 1 month ago

  • Status changed from Under Review to Resolved
  • % Done changed from 0 to 100
Actions #8

Updated by Benni Mack 8 days ago

  • Status changed from Resolved to Closed
Actions

Also available in: Atom PDF