You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Replaced invalid guard `@current_version < @from_position + @count` with proper
range validation `@from_position < 0 OR @from_position > @current_version`.
Previous logic incorrectly returned no results when valid messages existed.
New check correctly validates start position independently of page size.
Copy file name to clipboardExpand all lines: src/SqlServer/src/Eventuous.SqlServer/Scripts/5_ReadStreamBackwards.sql
+9-1Lines changed: 9 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -22,7 +22,15 @@ BEGIN
22
22
;THROW 50001, 'StreamNotFound', 1;
23
23
END;
24
24
25
-
IF @current_version < @from_position + @count
25
+
-- nothing to read / invalid request
26
+
IF @count <=0
27
+
BEGIN
28
+
RETURN;
29
+
END;
30
+
31
+
-- Validate the starting position for backwards read.
32
+
IF @from_position <0-- A negative starting position is invalid
33
+
OR @from_position > @current_version -- A starting position greater than the current version means we're trying to read from beyond the head of the stream
0 commit comments