MOVE(7)
π MOVE(7) β the PostgreSQL glow-up page
ok so quick vibe check: you're reading the PostgreSQL 15.19 Documentation page for MOVE, and honestly? she's a quiet icon. no rows returned, no drama, just pure positioning β¨
β¨ 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
bestie that's the whole menu and yes you can order any of it π
π¦ DESCRIPTION π¦
okay so MOVE repositions a cursor without retrieving any data. that's it. that's the whole job. she moves, she doesn't bring snacks back for you. π«Ά
MOVE works exactly like the FETCH command, except it only positions the cursor and does not return rows. so likeβ¦ FETCH's chill twin who shows up to the party and doesn't take anything from the fridge. π§
the parameters for the MOVE command are identical to those of the FETCH command; refer to FETCH(7) for details on syntax and usage. iykyk π
π OUTPUTS π
on successful completion, a MOVE command returns a command tag of the form:
MOVE count
count is the number of rows that a FETCH command with the same parameters would have returned (possibly zero). and yes, possibly zero β sometimes the answer is zero and that's still valid, no cap π
π EXAMPLES π
okay this one's a whole little story, watch:
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 how she skips 5 rows and the tag is literally MOVE 5? that's the whole flex. then FETCH 1 lands on row 6 like it was always meant to be. main character energy honestly π
π COMPATIBILITY π
there is no MOVE statement in the SQL standard. she's built different, she's a PostgreSQL original, she's not on the standardized syllabus π
π SEE ALSO π
go read FETCH(7) fr fr, that's where the real details live π
aaaaand that's the page bestie π huge thanks to the PostgreSQL 15.19 docs, dated 2026, for letting this cursor have her moment. mwah π stay positioned, stay iconic β
π¦ where this page comes from
- opensuse-leap 16.0: postgresql15 15.19-160000.1.1 Β· PostgreSQL
- opensuse-leap 16.0: postgresql15 15.19-160000.1.1 Β· PostgreSQL
- opensuse-leap 16.0: postgresql15 15.19-160000.1.1 Β· PostgreSQL
- opensuse-leap 16.0: postgresql15 15.19-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