MCPcopy Create free account
hub / github.com/PostHog/duckgres / cursorMoveFlow

Function cursorMoveFlow

tests/integration/cursor_test.go:132–144  ·  view source on GitHub ↗

cursorMoveFlow covers MOVE n advancing the position without returning rows.

(t *testing.T, db *sql.DB)

Source from the content-addressed store, hash-verified

130
131// cursorMoveFlow covers MOVE n advancing the position without returning rows.
132func cursorMoveFlow(t *testing.T, db *sql.DB) {
133 tx := beginCursorTx(t, db)
134
135 mustExecTx(t, tx, "DECLARE cur_move CURSOR FOR SELECT id, name FROM users ORDER BY id")
136
137 moved := fetchCursorRows(t, tx, "MOVE 4 FROM cur_move")
138 if len(moved) != 0 {
139 t.Errorf("MOVE 4 returned %d rows %v, want none", len(moved), moved)
140 }
141 assertCursorRows(t, "FETCH ALL after MOVE", fetchCursorRows(t, tx, "FETCH ALL FROM cur_move"), cursorUsers(5, 10))
142
143 mustExecTx(t, tx, "CLOSE cur_move")
144}
145
146// cursorBackwardFlow covers the forward-only restriction: backward fetch
147// fails with a clean error. NO SCROLL pins real PostgreSQL to the same

Callers 2

TestCursorSimpleQueryFunction · 0.85
TestCursorPostgresParityFunction · 0.85

Calls 5

beginCursorTxFunction · 0.85
mustExecTxFunction · 0.85
fetchCursorRowsFunction · 0.85
assertCursorRowsFunction · 0.85
cursorUsersFunction · 0.85

Tested by

no test coverage detected