MOVE(7)
π 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:
NEXTPRIORFIRSTLASTABSOLUTE countRELATIVE countcountALLFORWARDFORWARD countFORWARD ALLBACKWARDBACKWARD countBACKWARD 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
- opensuse-leap 16.0: postgresql16 16.15-160000.1.1 Β· PostgreSQL
- opensuse-leap 16.0: postgresql16 16.15-160000.1.1 Β· PostgreSQL
- opensuse-leap 16.0: postgresql16 16.15-160000.1.1 Β· PostgreSQL
- opensuse-leap 16.0: postgresql16 16.15-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