You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
PostgreSQL: a string restriction value with a backslash does not match the stored value #1716
On PostgreSQL, a string value in a dict restriction that contains a backslash does not match the row that stores that value. This holds for attributes and for JSON paths compared with a string.
prep_value in condition.py doubles every backslash in a string value on PostgreSQL before quoting it, as earlier releases did. PostgreSQL has standard_conforming_strings on by default, so in a plain '...' literal a backslash is an ordinary character. The doubled literal then names a different string.
tests/integration/test_restriction_values.py::test_string_with_backslash asserts the match on MySQL only.
2.3.x keeps the current behavior, so that a patch release does not change which rows a restriction selects.
Proposal for 2.4
Stop doubling backslashes in plain string values on PostgreSQL. Render them the way list values already are: as an E'...' literal with escaped backslashes, which reads the same whether standard_conforming_strings is on or off.
Extend test_string_with_backslash to PostgreSQL.
Note the change in the 2.4 release notes: a string restriction with a backslash now matches the stored value on PostgreSQL.
Activity