diff --git a/extensions/positron-duckdb/src/extension.ts b/extensions/positron-duckdb/src/extension.ts index 87c0b4752e8..b84b9c024f5 100644 --- a/extensions/positron-duckdb/src/extension.ts +++ b/extensions/positron-duckdb/src/extension.ts @@ -878,7 +878,10 @@ END`; const fetchValues = (adapter: (field: Vector, i: number) => ColumnValue) => { if ('first_index' in spec) { // There may be fewer rows available than what was requested - const lastIndex = Math.min(spec.last_index, queryResult.numRows - 1); + const lastIndex = Math.min( + spec.last_index, + spec.first_index + queryResult.numRows - 1 + ); const columnValues: Array = []; // Value range, we need to extract the actual slice requested