Repository navigation
fix(core): read a bare size as an attribute name - #1146
LeeroyHannigan wants to merge 1 commit into
Conversation
Amazon DynamoDB reads `size` as the function only where `(` follows it. Everywhere else in a projection, condition, filter, key condition or update expression it reads `size` as an attribute name. ExtendDB refused the word there as reserved. Measured in us-east-1 on 2026-11-14, 2026-11-16 and 2026-11-18, with each request sent twice. The service returned the projected `size` and `a.SIZE`, and the projected `size.x` of a map. It answered `SET size = :n` and `SET a = size` on a missing table with ResourceNotFoundException. It answered the key condition `size = :v` with "Query condition missed key schema element: pk". It also read `size` as a name in a condition, in a Query and a Scan filter, and in `REMOVE size`. The reserved word check now passes `size`. The word `status` stays reserved. A bare name in a SearchConditionExpression is still checked against the whole list, `size` included, since the service's answer there is not measured. Fixes #1028.
LJMart11
left a comment
There was a problem hiding this comment.
Reviewed at d7de36b. Core (1148), engine (870) and server (518) lib tests and the 11 new wire rows passed; both new guards fail a test when removed. Review covered the reserved-word change and the PR body's counts.
Docs — outside the diff
crates/core/src/expression/reserved_words.rs:38— Update the test counts in the PR body: it gives 513 forcargo test -p extenddb-server --liband says 5 backup_store tests fail on the test host. On this head that command ran 518 passed, 0 failed (the 5 failures are host-specific). Re-run and restate the count, or drop the host-failure note.
navareamol
left a comment
There was a problem hiding this comment.
The description says the word status stays reserved in a projection, a condition, a key condition and an update expression, and that a key condition on a table whose sort key is size, size[0], #n.size and size (b) get DynamoDB's answers. I think no test in this PR pins either claim. The wire row key-condition-size is a Query on a table without a size sort key, and neither the unit test nor the wire test has a status row. On a build of this head, status is still refused in a projection and a condition, and a key condition on a sort key named size works, so the behaviour looks right. A later change that breaks status or the sort key case would pass these tests.
Can you add rows for status in each of the four expression kinds, for a key condition on a sort key named size, and for size (b) with a space before the bracket?
I will approve once those rows are in.
What
ExtendDB now reads a bare
sizeas an attribute name in a projection, condition, filter, key condition and update expression, as DynamoDB does. Where(followssize, it is still the function. ASearchConditionExpressionstill refuses a baresize, since DynamoDB's answer there is not measured.Before this change, ExtendDB refused
sizeas a reserved word in every expression, becauseSIZEis on the reserved word list.is_reservedincrates/core/src/expression/reserved_words.rsnow returns false forsize. Its old body is nowis_listed, which theSearchConditionExpressioncheck insearch_condition_phases.rscalls.SIZEstays on the list, as on DynamoDB's published list of reserved words.Why
These are DynamoDB's answers, measured in us-east-1 on 14, 16 and 18 November 2026. Each request went out twice and got the same answer both times.
ProjectionExpressionsize, a.SIZEsizeanda.SIZEProjectionExpressionsize.x, b, wheresizeis a mapsize.xandbSET size = :nandSET a = size, on a table that does not existResourceNotFoundExceptionREMOVE sizesizeremovedKeyConditionExpressionsize = :vValidationException:Query condition missed key schema element: pkConditionExpressionsize = :vConditionalCheckFailedExceptionConditionExpressionattribute_exists(size)size, elseConditionalCheckFailedExceptionFilterExpressionsize = :vsizeread as a nameSIZE = :vin a key condition on a table whose sort key issize,size[0],#n.sizeandsize (b)get DynamoDB's answers too. The wordstatusstays reserved in a projection, a condition, a key condition and an update expression.Closes #1028
Testing done
cargo test -p extenddb-core --lib: 1148 passed, 1 ignored.cargo test -p extenddb-engine --lib: 870 passed.cargo test -p extenddb-server --lib: 513 passed. The 5backup_storetests that check file permissions fail on the test host, where a parent directory belongs to another user. This PR does not changebackup_store.rs.cargo +1.97.0 clippy -p extenddb-core -p extenddb-engine -p extenddb-server --all-targets -- -D warningsandcargo +1.97.0 fmt --all -- --checkare clean.TestSizeIsAnAttributeNameintests/test_expression_error_prefix.pysends 11 rows, and they fail against origin/main.size_with_no_paren_after_it_is_an_attribute_namereads the rows above. With the change reverted, it fails on thesize, a.SIZErow.cargo test -p extenddb-core --libpassed 1148, and clippy on the core and fmt are clean. The other runs above are on the commit before that change.Line counts: production +9 -2, tests +213.
Not in this PR, each in an open issue or PR:
SET a = size(b)gets ExtendDB's syntax error, where DynamoDB answersThe function is not allowed in an update expression; function: size.1 validation error detected:.Other open PRs:
resolve_paths, which also callsis_reserved. The projection rows keep their answers when both merge.size = :vto a table that does not exist and expectsResourceNotFoundException. DynamoDB gives that answer because it readssizeas a name, so the row keeps its answer when both PRs merge. DynamoDB checks a reserved word such asstatusbefore it looks up the table (measured 19 November 2026).Checklist
cargo test --workspace)cargo fmt --check)cargo clippy -- -W clippy::pedantic)Storagetrait, auth model, on-diskformat, or public CLI surface, an RFC has been accepted or is linked
below. Otherwise, an ADR captures the decision (link below).
ADR / RFC: n/a
By submitting this pull request, I confirm that my contribution is made under
the terms of the Apache License 2.0 and I agree to the Developer Certificate of
Origin (DCO). See CONTRIBUTING.md for details.