SPI_CURSOR_FETCH(3)

πŸ’– SPI_CURSOR_FETCH(3) πŸ’–

okay bestie, welcome to the PostgreSQL 18.6 docs, cursor edition πŸŽ€ this one's a little C function from the SPI family and it's genuinely so useful, no cap.


✨ NAME ✨

SPI_cursor_fetch β€” grab some rows from a cursor, that's the whole vibe πŸ¦‹


🌸 SYNOPSIS 🌸

void SPI_cursor_fetch(Portal portal, bool forward, long count)

πŸ‘‘ DESCRIPTION πŸ‘‘

So SPI_cursor_fetch fetches some rows from a cursor. That's it, that's the function πŸ’…

It's equivalent to a subset of the SQL command FETCH β€” like, the mini version. If you want more functionality, go check out SPI_scroll_cursor_fetch, she does the extra stuff 😌


🫢 ARGUMENTS 🫢

  • Portal portal β€” the portal that's holding your cursor. that's her house 🏠
  • bool forward β€” true means fetch forward, false means fetch backward. literally just which way you're walking the list πŸšΆβ€β™€οΈ
  • long count β€” the maximum number of rows to fetch. the cap, the limit, the ceiling ⭐

🌈 RETURN VALUE 🌈

If it works, SPI_processed and SPI_tuptable get set exactly the same way as they do in SPI_execute. same energy, same rules ✨


πŸ’€ NOTES πŸ’€

Fetching backward may fail if the cursor's plan was not created with the CURSOR_OPT_SCROLL option. so like… if you didn't build her with scroll energy, don't be shocked when she can't rewind πŸ™ˆ

and that's the whole page, bestie!! go forth and fetch responsibly πŸ§šβ€β™€οΈ

this has been the PostgreSQL 18.6 documentation, dated 2026 β€” mwah, ilysm, see you in the next manpage πŸ’–πŸŽ€πŸ¦‹