]> begriffs open source - ai-pg/blob - full-docs/man7/CLOSE.7
Convert HTML docs to more streamlined TXT
[ai-pg] / full-docs / man7 / CLOSE.7
1 '\" t
2 .\"     Title: CLOSE
3 .\"    Author: The PostgreSQL Global Development Group
4 .\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/>
5 .\"      Date: 2025
6 .\"    Manual: PostgreSQL 18.0 Documentation
7 .\"    Source: PostgreSQL 18.0
8 .\"  Language: English
9 .\"
10 .TH "CLOSE" "7" "2025" "PostgreSQL 18.0" "PostgreSQL 18.0 Documentation"
11 .\" -----------------------------------------------------------------
12 .\" * Define some portability stuff
13 .\" -----------------------------------------------------------------
14 .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
15 .\" http://bugs.debian.org/507673
16 .\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
17 .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
18 .ie \n(.g .ds Aq \(aq
19 .el       .ds Aq '
20 .\" -----------------------------------------------------------------
21 .\" * set default formatting
22 .\" -----------------------------------------------------------------
23 .\" disable hyphenation
24 .nh
25 .\" disable justification (adjust text to left margin only)
26 .ad l
27 .\" -----------------------------------------------------------------
28 .\" * MAIN CONTENT STARTS HERE *
29 .\" -----------------------------------------------------------------
30 .SH "NAME"
31 CLOSE \- close a cursor
32 .SH "SYNOPSIS"
33 .sp
34 .nf
35 CLOSE { \fIname\fR | ALL }
36 .fi
37 .SH "DESCRIPTION"
38 .PP
39 \fBCLOSE\fR
40 frees the resources associated with an open cursor\&. After the cursor is closed, no subsequent operations are allowed on it\&. A cursor should be closed when it is no longer needed\&.
41 .PP
42 Every non\-holdable open cursor is implicitly closed when a transaction is terminated by
43 \fBCOMMIT\fR
44 or
45 \fBROLLBACK\fR\&. A holdable cursor is implicitly closed if the transaction that created it aborts via
46 \fBROLLBACK\fR\&. If the creating transaction successfully commits, the holdable cursor remains open until an explicit
47 \fBCLOSE\fR
48 is executed, or the client disconnects\&.
49 .SH "PARAMETERS"
50 .PP
51 \fIname\fR
52 .RS 4
53 The name of an open cursor to close\&.
54 .RE
55 .PP
56 ALL
57 .RS 4
58 Close all open cursors\&.
59 .RE
60 .SH "NOTES"
61 .PP
62 PostgreSQL
63 does not have an explicit
64 \fBOPEN\fR
65 cursor statement; a cursor is considered open when it is declared\&. Use the
66 \fBDECLARE\fR
67 statement to declare a cursor\&.
68 .PP
69 You can see all available cursors by querying the
70 pg_cursors
71 system view\&.
72 .PP
73 If a cursor is closed after a savepoint which is later rolled back, the
74 \fBCLOSE\fR
75 is not rolled back; that is, the cursor remains closed\&.
76 .SH "EXAMPLES"
77 .PP
78 Close the cursor
79 liahona:
80 .sp
81 .if n \{\
82 .RS 4
83 .\}
84 .nf
85 CLOSE liahona;
86 .fi
87 .if n \{\
88 .RE
89 .\}
90 .SH "COMPATIBILITY"
91 .PP
92 \fBCLOSE\fR
93 is fully conforming with the SQL standard\&.
94 \fBCLOSE ALL\fR
95 is a
96 PostgreSQL
97 extension\&.
98 .SH "SEE ALSO"
99 \fBDECLARE\fR(7), \fBFETCH\fR(7), \fBMOVE\fR(7)