PostgreSQL: a string restriction value with a backslash does not match the stored value
维护者通常 5 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 新手友好度
- 78/100
调研方向
Start with prep_value in condition.py and read tests/integration/test_restriction_values.py::test_string_with_backslash to understand how string values and JSON path restrictions are tested. Extend the test to PostgreSQL, then check the 2.4 release notes. Done when PostgreSQL matches stored backslash values for attributes and JSON paths, the existing MySQL check still passes, and the change is documented.
由索引模型根据 Issue 内容生成。
描述
Summary
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.
Item.insert1(dict(item_id=5, name="back\\slash")) # stored: back\slash
Item & {"name": "back\\slash"} # MySQL: 1 row; PostgreSQL: 0 rows
Item & {"data.label": "back\\slash"} # same, for a JSON path
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 whetherstandard_conforming_stringsis on or off. - Extend
test_string_with_backslashto PostgreSQL. - Note the change in the 2.4 release notes: a string restriction with a backslash now matches the stored value on PostgreSQL.
- 主要语言
- Python
- 星标
- 198
- 派生
- 107
- 平均合并
- 4 天 7 小时
- 30 天内合并 PR
- 12
环境准备
- 提供 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
datajoint/datajoint-python 的其他 Issue
-
bug triage
难度 2/5 1-3 小时 新手友好度 76/100
datajoint/datajoint-python#1775 ·
维护者通常 5 天内回复
-
MySQL: with use_tls=False, 2.3.6 needs the cryptography package to log in to MySQL 8可能已有人在做 @dimitri-yatsenko 于 5 天前认领。 未关闭bug
难度 2/5 1-3 小时 新手友好度 74/100
datajoint/datajoint-python#1750 ·
维护者通常 5 天内回复
-
bug
难度 2/5 1-3 小时 新手友好度 78/100
datajoint/datajoint-python#1747 ·
维护者通常 5 天内回复
-
Reject constant defaults on primary-key attributes可能已有人在做 @godara-alt 于 4 天前认领。 未关闭bug
难度 2/5 1-3 小时 新手友好度 84/100
datajoint/datajoint-python#1712 ·
维护者通常 5 天内回复
-
Decoding a <blob> value in an unknown format returns None instead of raising an error可能已有人在做 @godara-alt 于 9 天前认领。 未关闭bug
难度 2/5 1-3 小时 新手友好度 78/100
datajoint/datajoint-python#1703 ·
维护者通常 5 天内回复
查看 datajoint/datajoint-python 的全部 Issue
相似的 Issue
-
[Bug]: test_remote_realpath_uses_argument_vector fails on Windows with Python 3.13+ (ntpath.isabs)可能已有人在做 @gouyu-hou 今天认领。 未关闭triage/confirmed
难度 1/5 1 小时以内 新手友好度 90/100
agentscope-ai/agentscope#4397 ·
维护者通常 2 天内回复
-
area/profiles area/sessions comp/desktop desktop/chat desktop/sessions P2 type/bug
难度 2/5 1-3 小时 新手友好度 75/100
NousResearch/hermes-agent#161712 ·
维护者通常 1 天内回复
-
[New Check]: postgresql_flexible_server_public_network_access_disabled可能已有人在做 @pouria-l 今天认领。 未关闭feature-request status/needs-triage
难度 2/5 1-3 小时 新手友好度 78/100
prowler-cloud/prowler#13615 · 1 条评论 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 78/100
SACGF/variantgrid#2941 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 82/100
linkedin/Liger-Kernel#1730 ·
维护者通常 3 天内回复