Skip to content

DynamoDB BETWEEN incorrectly excludes attribute value 0 #10186

Description

@Sohel2309

Bug

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

Reproduction

An item with:

price = 0

is incorrectly excluded from:

price BETWEEN 0 AND 100

while an item with price = 5 is included.

Root cause

FuncBetween.expr() checks the tested attribute using bare Python
truthiness (and attr). Since Decimal("0") is falsy, an attribute
whose value is zero incorrectly fails the condition.

The start and end operands already use zero-safe checks for this
exact reason, but attr does not.

Expected behavior

An attribute value of 0 should be included when it falls within the
specified BETWEEN range.

Metadata

Metadata

Assignees

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