1CLOSE(7)                 PostgreSQL 13.3 Documentation                CLOSE(7)
2
3
4

NAME

6       CLOSE - close a cursor
7

SYNOPSIS

9       CLOSE { name | ALL }
10

DESCRIPTION

12       CLOSE frees the resources associated with an open cursor. After the
13       cursor is closed, no subsequent operations are allowed on it. A cursor
14       should be closed when it is no longer needed.
15
16       Every non-holdable open cursor is implicitly closed when a transaction
17       is terminated by COMMIT or ROLLBACK. A holdable cursor is implicitly
18       closed if the transaction that created it aborts via ROLLBACK. If the
19       creating transaction successfully commits, the holdable cursor remains
20       open until an explicit CLOSE is executed, or the client disconnects.
21

PARAMETERS

23       name
24           The name of an open cursor to close.
25
26       ALL
27           Close all open cursors.
28

NOTES

30       PostgreSQL does not have an explicit OPEN cursor statement; a cursor is
31       considered open when it is declared. Use the DECLARE(7) statement to
32       declare a cursor.
33
34       You can see all available cursors by querying the pg_cursors system
35       view.
36
37       If a cursor is closed after a savepoint which is later rolled back, the
38       CLOSE is not rolled back; that is, the cursor remains closed.
39

EXAMPLES

41       Close the cursor liahona:
42
43           CLOSE liahona;
44

COMPATIBILITY

46       CLOSE is fully conforming with the SQL standard.  CLOSE ALL is a
47       PostgreSQL extension.
48

SEE ALSO

50       DECLARE(7), FETCH(7), MOVE(7)
51
52
53
54PostgreSQL 13.3                      2021                             CLOSE(7)
Impressum