MOVE(7)

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

πŸ’… MOVE(7) β€” the cursor glow-up πŸŽ€

okay so bestie, welcome to MOVE(7) from the PostgreSQL 16.15 documentation. This is the page for positioning a cursor, and it's lowkey giving β€œI don’t fetch rows, I just set the vibe.” ✨


🌸 NAME 🌸

MOVE - position a cursor πŸ’…

✨ SYNOPSIS ✨

MOVE [ direction ] [ FROM | IN ] cursor_name

where direction can be one of:

  • NEXT
  • PRIOR
  • FIRST
  • LAST
  • ABSOLUTE count
  • RELATIVE count
  • count
  • ALL
  • FORWARD
  • FORWARD count
  • FORWARD ALL
  • BACKWARD
  • BACKWARD count
  • BACKWARD ALL

πŸ¦‹ DESCRIPTION πŸ¦‹

okay so MOVE repositions a cursor without retrieving any data. That’s the whole main-character move: the cursor gets moved, and no rows come back. πŸ’…

MOVE works exactly like the FETCH command, except it only positions the cursor and does not return rows. It’s literally FETCH’s sibling with the row-returning part turned off. ✨

The parameters for the MOVE command are identical to those of the FETCH command. So for the full tea on syntax and usage, refer to FETCH(7) β€” iykyk. 🫢

πŸ’– OUTPUTS πŸ’–

On successful completion, a MOVE command returns a command tag of the form:

MOVE count

The count is the number of rows that a FETCH command with the same parameters would have returned (possibly zero). So yes, bestie, zero is a valid count β€” no crumbs returned, but still valid. πŸ’€

πŸŽ€ EXAMPLES πŸŽ€

okay, here’s the example from the page, copied exactly so you can see the whole cursor situation:

BEGIN WORK;
DECLARE liahona CURSOR FOR SELECT * FROM films;

-- Skip the first 5 rows:
MOVE FORWARD 5 IN liahona;
MOVE 5

-- Fetch the 6th row from the cursor liahona:
FETCH 1 FROM liahona;
 code  | title  | did | date_prod  |  kind  |  len
-------+--------+-----+------------+--------+-------
 P_303 | 48 Hrs | 103 | 1982-10-22 | Action | 01:37
(1 row)

-- Close the cursor liahona and end the transaction:
CLOSE liahona;
COMMIT WORK;

⭐ COMPATIBILITY ⭐

no cap: there is no MOVE statement in the SQL standard. That’s the compatibility tea, periodt. πŸ’…

🌈 SEE ALSO 🌈


πŸ’– That’s the MOVE(7) vibe! This page is from PostgreSQL 16.15, dated 2026 β€” mwah, bye bestie! πŸ’…βœ¨

πŸ“¦ where this page comes from