diff --git a/src/Persistence/Sql/Postgresql/Query.php b/src/Persistence/Sql/Postgresql/Query.php index 5be49dfe2..5146559c3 100644 --- a/src/Persistence/Sql/Postgresql/Query.php +++ b/src/Persistence/Sql/Postgresql/Query.php @@ -58,7 +58,7 @@ function ($sqlLeft, $sqlRight) use ($makeSqlFx) { // replace backslash in "\xddd" for LIKE/REGEXP $res = 'regexp_replace(' . $res . ', ' . $this->escapeStringLiteral('(?escapeStringLiteral('\1~~bytea~\3~~') . ', ' + . $this->escapeStringLiteral("\\1\u{00a9}\\3\u{00a9}") . ', ' . $this->escapeStringLiteral('g') . ')'; // revert double backslashes diff --git a/tests/ConditionSqlTest.php b/tests/ConditionSqlTest.php index e611e0fb3..84319626b 100644 --- a/tests/ConditionSqlTest.php +++ b/tests/ConditionSqlTest.php @@ -707,11 +707,6 @@ public function testRegexpCondition(string $type, bool $isBinary): void self::assertSame([1], $findIdsRegexFx('name', 'John')); self::assertSame($isBinary ? [] : [1], $findIdsRegexFx('name', 'john')); - - if ($this->getDatabasePlatform() instanceof PostgreSQLPlatform && $isBinary) { - return; // TODO - } - self::assertSame($isBinaryMysql8x ? [] : [13], $findIdsRegexFx('name', 'heiß')); self::assertSame($isBinary ? [] : [13], $findIdsRegexFx('name', 'Heiß')); self::assertSame([1], $findIdsRegexFx('name', 'Joh')); diff --git a/tests/Persistence/Sql/QueryTest.php b/tests/Persistence/Sql/QueryTest.php index 43ade0492..e2e60fbfe 100644 --- a/tests/Persistence/Sql/QueryTest.php +++ b/tests/Persistence/Sql/QueryTest.php @@ -881,7 +881,7 @@ public function testWhereSpecialValues(): void } self::assertSame( <<<'EOF' - where case when pg_typeof("name") = 'bytea'::regtype then replace(regexp_replace(encode(case when pg_typeof("name") = 'bytea'::regtype then decode(case when pg_typeof("name") = 'bytea'::regtype then replace(substring(cast("name" as text) from 3), chr(92), repeat(chr(92), 2)) else '' end, 'hex') else cast(replace(cast("name" as text), chr(92), repeat(chr(92), 2)) as bytea) end, 'escape'), '(?where('name', 'like', 'foo')->render()[0] ); @@ -925,7 +925,7 @@ public function testWhereSpecialValues(): void } self::assertSame( <<<'EOF' - where case when pg_typeof("name") = 'bytea'::regtype then replace(regexp_replace(encode(case when pg_typeof("name") = 'bytea'::regtype then decode(case when pg_typeof("name") = 'bytea'::regtype then replace(substring(cast("name" as text) from 3), chr(92), repeat(chr(92), 2)) else '' end, 'hex') else cast(replace(cast("name" as text), chr(92), repeat(chr(92), 2)) as bytea) end, 'escape'), '(?where('name', 'regexp', 'foo')->render()[0] );