MOVE(7)
π MOVE(7) β the postgres manual but make it make sense
okay so this is the MOVE(7) page from the PostgreSQL 14.24 Documentation, and honestly? it's a sleeper hit. bestie, it's short, it's sweet, and it does exactly one thing. let's get into it π«Ά
β¨ NAME β¨
MOVE β literally just position a cursor. that's it. that's the whole job. no rows come back, no drama, just vibes and placement π
π SYNOPSIS π
MOVE [ direction ] [ FROM | IN ] cursor_name
and direction can be any one of these iconic little numbers:
NEXT
PRIOR
FIRST
LAST
ABSOLUTE count
RELATIVE count
count
ALL
FORWARD
FORWARD count
FORWARD ALL
BACKWARD
BACKWARD count
BACKWARD ALL
likeβ¦ the range? unmatched. π
π¦ DESCRIPTION π¦
so MOVE repositions a cursor without retrieving any data. read that again. it moves the little guy around, but does NOT bring home the rows. it's giving "window shopping only" energy ποΈ
MOVE works exactly like the FETCH command, except β and this is the key part, iykyk β it only positions the cursor and does not return rows.
the parameters for MOVE are identical to those of the FETCH command, so if you want the full tea on syntax and usage, sprint over to FETCH(7). go go go πββοΈπ¨
πΈ OUTPUTS πΈ
on successful completion (slay), a MOVE command returns a command tag that looks like this:
MOVE count
and count is the number of rows that a FETCH command with the same parameters would have returned β (possibly zero). yes, zero is a valid answer, don't come for her π
π EXAMPLES π
this is the part where we actually do the thing. buckle up, bestie:
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;
see what she did there? MOVE FORWARD 5 skipped five rows, then FETCH 1 grabbed the 6th. that's the whole trick. main character cursor energy π
π COMPATIBILITY π
not to be the bearer of bad news butβ¦ there is no MOVE statement in the SQL standard. she's built different. she's a PostgreSQL original. periodt π
β SEE ALSO β
go read these next, they're all connected, it's a whole cinematic universe:
okay that's the page!! π§ββοΈπ this was brought to you by PostgreSQL 14.24, dated 2026, and the MOVE(7) manual page. now go forth and position your cursors responsibly. mwah πβ¨π«Ά
π¦ where this page comes from
- opensuse-leap 16.0: postgresql14 14.24-160000.1.1 Β· PostgreSQL
- opensuse-leap 16.0: postgresql14 14.24-160000.1.1 Β· PostgreSQL
- opensuse-leap 16.0: postgresql14 14.24-160000.1.1 Β· PostgreSQL
- opensuse-leap 16.0: postgresql14 14.24-160000.1.1 Β· PostgreSQL
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms