Skip to content

Arithmetic on an index key: the type mismatch names N where the service names a set of types #702

Open

Description

@LeeroyHannigan

What the service does

Measured against DynamoDB (us-east-1) on 2026-10-31 at 15:03 and 21:53 UTC, each request sent twice with identical answers, on a table with a GSI gsi_s on sidx (S). The item is r = {pk: r, n: N 5}.

  • UpdateItem SET sidx = :one + :one (sent at both times), SET sidx = n + :one (15:03) and SET sidx = :one - :one (21:53): ValidationException: One or more parameter values were invalid: Type mismatch for Index Key sidx Expected: S Actual: {N,HD,DOUBLE,FLOAT} IndexName: gsi_s, every time.
  • TransactWriteItems with the same Update as a member: cancellation reason ValidationError with One or more parameter values were invalid: Type mismatch for Index Key sidx Expected: S Actual: {HD, N, DECIMAL, DOUBLE, INT, FLOAT} IndexName: gsi_s for every arithmetic member at 15:03, and Actual: {FLOAT, N, HD, DOUBLE, INT, DECIMAL} at 21:53. The six names are the same; their order changed between the two measurements.

What ExtendDB does

A SQLite server built from main (f49c5f823) answers every one of these with Actual: N, for example One or more parameter values were invalid: Type mismatch for Index Key sidx Expected: S Actual: N IndexName: gsi_s.

Proposed change

When the value written to an index key is an arithmetic expression, write the service's set in the Actual field: {N,HD,DOUBLE,FLOAT} on UpdateItem, and the six names in braces, {HD, N, DECIMAL, DOUBLE, INT, FLOAT}, in TransactWriteItems. A test of the TransactWriteItems text can compare the set of names, since the service's order varies.

Activity

  1. LeeroyHannigan commented on Nov 9, 2026

    @LeeroyHannigan
    CollaboratorAuthor

    PartiQL UPDATE gives a third form of the set. Measured against DynamoDB (us-east-1) on 2026-11-09 at 11:45 UTC, each statement sent once, on a table with a GSI gsi_s on sidx (S). Each statement was UPDATE "<table>" SET ... WHERE pk = 'pqd-none', and that key holds no item:

    • SET sidx = n + 1: ValidationException: One or more parameter values were invalid: Type mismatch for Index Key sidx Expected: S Actual: {N, FLOAT, INT, DOUBLE, HD} IndexName: gsi_s
    • SET sidx = list_append(l, [1]): the same text with Actual: L
    • SET sidx = 5: the same text with Actual: N
    • SET sidx = '': the refusal of an empty string for a secondary index key
    • SET sidx = 'x': ConditionalCheckFailedException

    So the service checks the value type before the condition of the missing item.

    From the code, main answers the first two statements with the condition failure, because its PartiQL path does not type an arithmetic or list_append value. #853 types both, and its text for the arithmetic is Actual: N.

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions