Skip to content

fix(dynamodb): BETWEEN filter incorrectly excludes attribute value 0 - #10187

Open
Sohel2309 wants to merge 1 commit into
getmoto:masterfrom
Sohel2309:fix/dynamodb-between-zero-attribute
Open

fix(dynamodb): BETWEEN filter incorrectly excludes attribute value 0#10187
Sohel2309 wants to merge 1 commit into
getmoto:masterfrom
Sohel2309:fix/dynamodb-between-zero-attribute

Conversation

@Sohel2309

Copy link
Copy Markdown

Bug

DynamoDB BETWEEN filtering incorrectly excludes items whose attribute
value is exactly 0, even when 0 is within the specified range.

Root cause

FuncBetween.expr() checked the tested attribute using bare Python
truthiness (and attr). Since Decimal("0") is falsy, an attribute
whose value is zero was incorrectly treated as having no value.

The start and end operands already use zero-safe checks for this
exact case.

Fix

Apply the same zero-safe value check to the attribute being tested.

Testing

  • Added regression coverage for attribute value 0
  • Confirmed the regression test fails on the unfixed code
  • Confirmed the targeted tests pass after the fix
  • 3/3 relevant tests pass
  • git diff --check passes

@Sohel2309
Sohel2309 force-pushed the fix/dynamodb-between-zero-attribute branch from 63c337d to 88bcd3e Compare August 14, 2026 02:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant