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

Function cursorMissingFlow

tests/integration/cursor_test.go:169–187  ·  view source on GitHub ↗

cursorMissingFlow covers FETCH/CLOSE on a cursor that was never declared. Each statement gets its own transaction because the error aborts the transaction on real PostgreSQL.

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

Source from the content-addressed store, hash-verified

167// Each statement gets its own transaction because the error aborts the
168// transaction on real PostgreSQL.
169func cursorMissingFlow(t *testing.T, db *sql.DB) {
170 tx := beginCursorTx(t, db)
171 rows, err := tx.Query("FETCH 1 FROM cur_never_declared")
172 if err == nil {
173 _ = rows.Close()
174 t.Fatal("FETCH from undeclared cursor succeeded, want error")
175 }
176 if !strings.Contains(err.Error(), `cursor "cur_never_declared" does not exist`) {
177 t.Errorf("FETCH from undeclared cursor: error = %q", err)
178 }
179 _ = tx.Rollback()
180
181 tx2 := beginCursorTx(t, db)
182 if _, err := tx2.Exec("CLOSE cur_never_declared"); err == nil {
183 t.Fatal("CLOSE of undeclared cursor succeeded, want error")
184 } else if !strings.Contains(err.Error(), `cursor "cur_never_declared" does not exist`) {
185 t.Errorf("CLOSE of undeclared cursor: error = %q", err)
186 }
187}
188
189// TestCursorSimpleQuery exercises the simple-query-protocol cursor path
190// against Duckgres.

Callers 2

TestCursorSimpleQueryFunction · 0.85
TestCursorPostgresParityFunction · 0.85

Calls 6

beginCursorTxFunction · 0.85
QueryMethod · 0.65
CloseMethod · 0.65
RollbackMethod · 0.65
ExecMethod · 0.65
ErrorMethod · 0.45

Tested by

no test coverage detected