PostgreSQL: a string restriction value with a backslash does not match the stored value
Mantenedores costumam responder em até 5 dias
Ninguém assumiu esta issue ainda.
Avaliação
- Dificuldade
- 3/5
- Tempo estimado
- 1-2 dias
- Facilidade para iniciantes
- 78/100
Direção de pesquisa
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.
Escrita pelo modelo de indexação a partir do texto da issue.
Descrição
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.
- Linguagem predominante
- Python
- Estrelas
- 198
- Forks
- 107
- Merge médio
- 4d 7h
- PRs com merge (30d)
- 12
Preparar o ambiente
- Inclui um Dockerfile ou arquivo Docker Compose
- Sem modelo de pull request
- Ler o guia de contribuição
Primeiros passos
- Leia a issue inteira e depois o guia de contribuição do projeto.
- Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
- Faça um fork do repositório e trabalhe em uma branch.
- Abra um pull request que referencie o número da issue.
Mais de datajoint/datajoint-python
-
bug triage
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 76/100
datajoint/datajoint-python#1775 ·
Mantenedores costumam responder em até 5 dias
-
MySQL: with use_tls=False, 2.3.6 needs the cryptography package to log in to MySQL 8Talvez já em andamento @dimitri-yatsenko assumiu há 5 dias. Abertabug
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 74/100
datajoint/datajoint-python#1750 ·
Mantenedores costumam responder em até 5 dias
-
bug
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 78/100
datajoint/datajoint-python#1747 ·
Mantenedores costumam responder em até 5 dias
-
Reject constant defaults on primary-key attributesTalvez já em andamento @godara-alt assumiu há 4 dias. Abertabug
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 84/100
datajoint/datajoint-python#1712 ·
Mantenedores costumam responder em até 5 dias
-
Decoding a <blob> value in an unknown format returns None instead of raising an errorTalvez já em andamento @godara-alt assumiu há 9 dias. Abertabug
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 78/100
datajoint/datajoint-python#1703 ·
Mantenedores costumam responder em até 5 dias
Todas as issues de datajoint/datajoint-python
Issues semelhantes
-
[Bug]: test_remote_realpath_uses_argument_vector fails on Windows with Python 3.13+ (ntpath.isabs)Talvez já em andamento @gouyu-hou assumiu hoje. Abertatriage/confirmed
Dificuldade 1/5 Menos de uma hora Facilidade para iniciantes 90/100
agentscope-ai/agentscope#4397 ·
Mantenedores costumam responder em até 2 dias
-
area/profiles area/sessions comp/desktop desktop/chat desktop/sessions P2 type/bug
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 75/100
NousResearch/hermes-agent#161712 ·
Mantenedores costumam responder em até 1 dia
-
[New Check]: postgresql_flexible_server_public_network_access_disabledTalvez já em andamento @pouria-l assumiu hoje. Abertafeature-request status/needs-triage
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 78/100
prowler-cloud/prowler#13615 · 1 comentário ·
Mantenedores costumam responder em até 1 dia
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 78/100
SACGF/variantgrid#2941 ·
Mantenedores costumam responder em até 1 dia
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 82/100
linkedin/Liger-Kernel#1730 ·
Mantenedores costumam responder em até 3 dias