MOVE(7)
π MOVE (7) β like, position a cursor, bestie
okay so this one is from the PostgreSQL 17.11 docs and it's genuinely so chill β no cap, MOVE is the low-key sibling of FETCH and it literally just... points the cursor somewhere. that's it. that's the whole vibe. β¨
πΈ NAME πΈ
MOVE β position a cursor π―
β¨ SYNOPSIS β¨
MOVE [ direction ] [ FROM | IN ] cursor_name
where direction can be one of these icons π (yes, all of them, I'm not skipping a single one):
NEXT
PRIOR
FIRST
LAST
ABSOLUTE count
RELATIVE count
count
ALL
FORWARD
FORWARD count
FORWARD ALL
BACKWARD
BACKWARD count
BACKWARD ALL
NEXTPRIORFIRSTLASTABSOLUTE countRELATIVE countcountALLFORWARDFORWARD countFORWARD ALLBACKWARDBACKWARD countBACKWARD ALL
π¦ DESCRIPTION π¦
so MOVE repositions a cursor and retrieves zero data. like, it's giving "I'm just here to move, not to fetch" energy π
. MOVE works exactly like the FETCH command, except β huge difference, bestie β 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 details on syntax and usage you gotta refer to FETCH(7). iykyk π«Ά
π OUTPUTS π
on successful completion, a MOVE command returns a command tag that looks like this:
MOVE count
the count is the number of rows that a FETCH command with the same parameters would have returned (possibly zero). yes, possibly zero β she can absolutely return nothing and still slay π
π₯ EXAMPLES π₯
here's the whole little scenario, verbatim, eat it up π:
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;
look at that cursor named liahona living her best main character life ππ
π COMPATIBILITY π
there is no MOVE statement in the SQL standard. periodt. so if some standard-conformance checker comes for you, that's the tea π
π SEE ALSO π
fr fr, go readFETCH(7)βMOVEis literally the same parameter list, she just refuses to hand over the rows π
okay bye bestie, this page was PostgreSQL 17.11, dated 2026, and it's literally iconic β see you in the next manpage π§β¨ππ¦πΈ
π¦ where this page comes from
- opensuse-leap 16.0: postgresql17 17.11-160000.1.1 Β· PostgreSQL
- opensuse-leap 16.0: postgresql17 17.11-160000.1.1 Β· PostgreSQL
- opensuse-leap 16.0: postgresql17 17.11-160000.1.1 Β· PostgreSQL
- opensuse-leap 16.0: postgresql17 17.11-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