Problem/Motivation
The module currently has a compatibility issue when used with PostgreSQL.
I get this error if both "Case sensitive" and "Match whole word" are both selected when using postgresql version 16.14 (tested) or higher (also tested)
SQLSTATE[2201B]: Invalid regular expression: 7 ERROR:
invalid regular expression: quantifier operand invalid:
SELECT "base_table"."vid" AS "vid", "base_table"."nid" AS "nid"
FROM "c1pgags12dev"."node" "base_table"
INNER JOIN "c1pgags12dev"."node_field_data" "node_field_data"
ON "node_field_data"."nid" = "base_table"."nid"
INNER JOIN "c1pgags12dev"."node__body" "node__body"
ON "node__body"."entity_id" = "base_table"."nid"
AND "node__body"."langcode" = :langcode0 WHERE ("node_field_data"."type" = :db_condition_placeholder_1)
AND ("node_field_data"."langcode" = :db_condition_placeholder_2)
AND ("node__body"."body_value"::text ~* :db_condition_placeholder_3);
Array ( [:db_condition_placeholder_1] => empl [:db_condition_placeholder_2] => en [:db_condition_placeholder_3] => (?-i)[[:<:]]tfoot[[:>:]] [:langcode0] => en ) in Drupal\Core\Entity\Query\Sql\Query->result() (line 288 of core/lib/Drupal/Core/Entity/Query/Sql/Query.php).
Proposed resolution
See merge request and/or patch
Support Postgres.
Remaining tasks
Review and test patch.
User interface changes
Allows selecting "Case insensitive" option WITH "Match word" without crashing WSOD.
API changes
None.
Data model changes
None.
Comments
Comment #2
joseph.olstadah yes, we just noticed this also.
Comment #3
joseph.olstadComment #4
joseph.olstadPostgreSQL's documentation specifically says
(?c)forces case-sensitive matching even when the surrounding regexp operator requested case-insensitive matching, which is exactly what we need because Drupal converts REGEXP to~*.Comment #6
joseph.olstadComment #7
joseph.olstadThis works!
Comment #8
liam morlandLooks good
Comment #9
smustgrave commentedThanks!
Comment #12
joseph.olstad@smustgrave
thanks!
Comment #13
smustgrave commentedTagged a small release to get this into the wild.
Comment #14
joseph.olstadGreat!