SPI_SCRO...SOR_FETCH(3)

πŸ“¦ version 17.11, in opensuse-leap 16.0

hii bestie πŸ’– you're on the SPI_SCRO...SOR_FETCH(3) page from the PostgreSQL 17.11 manual β€” it's all about SPI_scroll_cursor_fetch, and yes, we're gonna make it make sense.

NAME ✨

SPI_scroll_cursor_fetch β€” fetch some rows from a cursor, bestie. That's the whole vibe.

SYNOPSIS πŸŽ€

void SPI_scroll_cursor_fetch(Portal portal, FetchDirection direction,
                             long count)

DESCRIPTION πŸ’…

Okay so SPI_scroll_cursor_fetch fetches some rows from a cursor. It is literally equivalent to the SQL command FETCH. No cap.

ARGUMENTS πŸ¦‹

  • Portal portal β€” the portal containing the cursor. That's the main character right there.
  • FetchDirection direction β€” one of FETCH_FORWARD, FETCH_BACKWARD, FETCH_ABSOLUTE, or FETCH_RELATIVE. Pick your fighter πŸ’…
  • long count β€” number of rows to fetch for FETCH_FORWARD or FETCH_BACKWARD; absolute row number to fetch for FETCH_ABSOLUTE; or relative row number to fetch for FETCH_RELATIVE. The way this one little argument changes meaning depending on direction? iconic, honestly.

RETURN VALUE πŸ’–

SPI_processed and SPI_tuptable are set as in SPI_execute if successful. So if it slays, those get set β€” periodt.

NOTES 🌸

See the SQL FETCH(7) command for details of the interpretation of the direction and count parameters. iykyk.

Direction values other than FETCH_FORWARD may fail if the cursor's plan was not created with the CURSOR_OPT_SCROLL option. Lowkey important β€” do not sleep on that, bestie 😭

xoxo, PostgreSQL 17.11 β€” 2026, from your SPI_SCRO...SOR_FETCH(3) bestie πŸ§šβ€β™€οΈπŸ’œ

πŸ“¦ where this page comes from