-
Notifications
You must be signed in to change notification settings - Fork 14
Open
Description
The code inserts partial newline-sensitive matching into regex expressions when required. For example, this query:
{"name":{ "$regex":"forest"}}
correctly leads to:
record->>'name' ~ '(\?p)forest'
However, when more than one is present, only the first one escapes the question mark. For example, this query:
{"$or":[{"name":{ "$regex":"forest"}},{"entity.description":{ "$regex":"forest"}}]}
incorrectly leads to:
(record->>'name' ~ '(\?p)forest' OR record->'entity'->>'description' ~ '(?p)forest')
Here the latter (?p) should be (\?p). Without the escaped question-mark, Postgres interprets this as a replacement parameter.
A workaround for this is to escape such instances manually after the convert:
where.replaceAll(/'\(\?([^\)]+)\)/g, "'(\\?$1)");
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels