Repository navigation
Restrictions by JSON objects with non-ASCII text match; a uuid restricted by bytes raises DataJointError - #1735
Open
dimitri-yatsenko wants to merge 2 commits into
Open
dimitri-yatsenko wants to merge 2 commits into
dimitri-yatsenko wants to merge 2 commits into
Conversation
…D values for uuid attributes A dict value for a JSON path was rendered with json.dumps' default ensure_ascii=True, so non-ASCII characters became \u escapes while both servers render the stored JSON with the characters themselves. Such a restriction matched no rows on MySQL or PostgreSQL. A uuid attribute restricted or inserted with bytes raised a bare TypeError from uuid.UUID. It now raises DataJointError, as other badly formed UUID values do. Adds the tests requested in the issue: quoted values in restrictions on joins, renamed projections, aggregations and dj.Top; cascading delete and update1; and values from record arrays, numpy.void rows and DataFrame rows.
dimitri-yatsenko
requested review from
MilagrosMarin,
lum-agilyti and
ttngu207
November 21, 2026 01:34
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Two restriction bugs that followed the restriction-value changes in 2.3.6 (GHSA-pv3r-mxv6-wccj):
{"data.sub": {"name": "Zoë"}}, matched no rows when it held non-ASCII text. The value was rendered withjson.dumps, which escapes non-ASCII characters (ëbecomes\u00eb). Both servers render the stored JSON with the characters themselves. This was reproduced on MySQL 8.0 and also on PostgreSQL 15.uuidattribute by abytesvalue raised a bareTypeError. Insertingbytesinto auuidattribute did the same.Changes
ensure_ascii=False. It is still quoted through the backend adapter, as before.uuidrestriction value that cannot be read as a UUID raisesDataJointError("Badly formed UUID ..."), forbytesas for other types. The message now names the attribute once, without doubled backticks.bytesvalue into auuidattribute raisesDataJointErrorinstead ofTypeError.Behavior change
bytesvalue for auuidattribute, in a restriction or an insert: before, aTypeError; now aDataJointError.Tests
tests/unit/test_condition.pycheck the rendered JSON literal and theDataJointErrorfor non-UUID values, on both backends.tests/integration/test_restriction_values.pyrun on MySQL and PostgreSQL. They add the cases requested in the issue:proj, anaggr, and withdj.Top;delete()andupdate1()with quoted values;numpy.voidrows, and DataFrame rows.item_with_tagsfixture inserts its rows as dicts, not positional tuples.Fixes #1715