Skip to content

In-memory DynamoDB: smaller PartiQL and expression parity gaps #97

Closed

Description

@fctl-sh

Priority: low. Statements and expressions the in-memory backend handles differently from DynamoDB (backend/memory/partiql.rs, expr/):

  • PartiQL batches and transactions: BatchExecuteStatement accepts a mix of reads and writes ("The entire batch must consist of either read statements or write statements"); ReturnValuesOnConditionCheckFailure=ALL_OLD is ignored in batches (BatchStatementError.Item) and in ExecuteTransaction (CancellationReason.Item); a missing table in ExecuteTransaction gives TransactionCanceledException with reason ResourceNotFound (memory TransactWriteItems fails with ResourceNotFoundException), and in a batch read "must specify the primary key".
  • PartiQL syntax: a negative literal after a keyword fails (WHERE n BETWEEN -5 AND 5, n = 1 OR -3 = n); DELETE ... RETURNING ALL NEW *, INSERT INTO table.index, an UPDATE without SET/REMOVE, exists(path), Limit=0 and an 80-character ExecuteTransaction token are accepted; SET c = set_add(b, <<'t'>>) ignores b, and set_add(n, 5) adds numbers.
  • PartiQL capacity: SELECT always reports TOTAL (also when INDEXES was asked for), a DELETE of a missing item reports none, and batch reads and read transactions report nothing.
  • Expressions: the 300 operators/functions limit is not enforced ("The expression contains too many operators; operator count: 301"); redundant parentheses (((a = :v))) are accepted ("The expression has redundant parentheses"); the 255-byte limit of placeholder names is not enforced; empty attribute names are accepted through placeholders and in items, and so are names of 64 KB or more; contains(a, a) and attribute_type(a, b) (a path as the type) are accepted; placeholders with invalid characters (#a-b) are reported as unused rather than invalid; _core._check_expressions skips validate_update.
  • Messages: the hash key size message lacks DynamoDB's missing space ("maximum size limit of2048 bytes"), an UpdateItem over 400 KB uses PutItem's message ("Item size to update has exceeded the maximum allowed size"), and an empty binary index key says "empty string value".

Found in a review of the library for bugs (fctl session); the fixes that fit in its ten pull requests are #61 to #65, #67 to #70 and #72.

Activity

  1. added
    bug
    rust
    on Oct 30, 2026
  2. fctl-sh commented on Oct 30, 2026

    @fctl-sh
    ContributorAuthor

    More gaps of this kind, found while fixing #75 (#104) by comparing the in-memory ExecuteTransaction and BatchExecuteStatement with dynoxide-rs, whose tests and notes say they were captured against DynamoDB (eu-west-2 and us-east-1). Each was checked on the memory backend:

    • Batches naming an item twice: DynamoDB refuses the whole BatchExecuteStatement before running any statement, with ValidationException: Provided list of item keys contains duplicates (tests/partiql.rs, test_batch_execute_rejects_duplicate_item_keys). The memory backend runs both statements (an INSERT and an UPDATE of one item both succeed).
    • RETURNING in a transaction: DynamoDB refuses it with a top-level ValidationException, Validation failed in TransactStatements[0]: RETURNING clause is not supported in ExecuteTransaction. (src/actions/execute_transaction.rs). The memory backend runs the statement and ignores the clause.
    • Mixed transactions: DynamoDB's message is ExecuteTransaction API does not support both read and write operations in the same request. (tests/execute_transaction.rs, test_mixed_select_and_insert); the memory backend says Transaction must contain either all reads or all writes.
    • A key attribute given two values: DynamoDB refuses UPDATE and DELETE statements such as ... WHERE pk = 'x' AND pk = 'y' AND sk = 1 with Multiple conditions on same key pk. Only single item Update/Insert/Delete are supported (src/partiql/executor.rs, single_item_key). The memory backend uses the first value and fails with ConditionalCheckFailedException.
  3. fctl-sh commented on Oct 31, 2026

    @fctl-sh
    ContributorAuthor

    Most of this issue, and the gaps of the comment above, are handled in #135, following what dynoxide-rs captured against DynamoDB: mixed and repeated-item PartiQL batches, RETURNING and mixed reads and writes in ExecuteTransaction, a key given two values, ALL_OLD items in batches and transactions, missing tables in batch reads, negative literals after keywords, DELETE ... RETURNING ALL NEW *, writes to an index, UPDATE without SET/REMOVE, exists(), Limit=0, long transaction tokens, set_add/set_delete arguments, PartiQL capacity (INDEXES, deletes of missing items, batch reads, read transactions, and the transactional factor applying to the table only), the 300-operator limit, redundant parentheses, empty attribute names, contains(a, a), _check_expressions validating update paths, and the three messages.

    Left, because no source I could check settles them (and the sandbox has no AWS credentials):

    • The 255-byte limit of placeholder names (#name, :value): documented, but no source gives the error message.
    • Attribute names of 64 KB or more: the docs say names must be "less than 64 KB"; no source for the message.
    • attribute_type(a, b) with a path as the type: dynoxide-rs accepts it in classic expressions (and evaluates it to false); DynamoDB's answer is not captured. In PartiQL it is refused.
    • Placeholders with invalid characters (#a-b): probably a syntax error at -, by inference from the tokenizer; not captured.
    • A read-only ExecuteTransaction on a missing table: the captured answer for writes is a TransactionCanceledException with reason ResourceNotFound; for reads it is only inferred, so the memory backend keeps its top-level ResourceNotFoundException.

    Each can be settled with one call against DynamoDB, for example aws dynamodb query with --expression-attribute-names holding a 256-byte #placeholder, or aws dynamodb execute-transaction with one SELECT on a missing table.

  4. added 2 commits that reference this issue on Oct 31, 2026
    5c831f1
    6f7b82e
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugrust

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions