Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitc90f4e5

Browse files
committed
Doc: write some for adminpack.
Previous contents of adminpack.sgml were rather far short of project norms.Not to mention being outright wrong about the signature of pg_file_read().
1 parentaa8c64a commitc90f4e5

File tree

1 file changed

+140
-18
lines changed

1 file changed

+140
-18
lines changed

‎doc/src/sgml/adminpack.sgml

Lines changed: 140 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -12,29 +12,151 @@
1212
<application>pgAdmin</> and other administration and management tools can
1313
use to provide additional functionality, such as remote management
1414
of server log files.
15+
Use of all these functions is restricted to superusers.
1516
</para>
1617

17-
<sect2>
18-
<title>Functions Implemented</title>
18+
<para>
19+
The functions shown in <xref linkend="functions-adminpack-table"> provide
20+
write access to files on the machine hosting the server. (See also the
21+
functions in <xref linkend="functions-admin-genfile-table">, which
22+
provide read-only access.)
23+
Only files within the database cluster directory can be accessed, but
24+
either a relative or absolute path is allowable.
25+
</para>
26+
27+
<table id="functions-adminpack-table">
28+
<title><filename>adminpack</> Functions</title>
29+
<tgroup cols="3">
30+
<thead>
31+
<row><entry>Name</entry> <entry>Return Type</entry> <entry>Description</entry>
32+
</row>
33+
</thead>
1934

20-
<para>
21-
The functions implemented by <filename>adminpack</> can only be run by a
22-
superuser. Here's a list of these functions:
35+
<tbody>
36+
<row>
37+
<entry><function>pg_catalog.pg_file_write(filename text, data text, append boolean)</function></entry>
38+
<entry><type>bigint</type></entry>
39+
<entry>
40+
Write, or append to, a text file
41+
</entry>
42+
</row>
43+
<row>
44+
<entry><function>pg_catalog.pg_file_rename(oldname text, newname text <optional>, archivename text</optional>)</function></entry>
45+
<entry><type>boolean</type></entry>
46+
<entry>
47+
Rename a file
48+
</entry>
49+
</row>
50+
<row>
51+
<entry><function>pg_catalog.pg_file_unlink(filename text)</function></entry>
52+
<entry><type>boolean</type></entry>
53+
<entry>
54+
Remove a file
55+
</entry>
56+
</row>
57+
<row>
58+
<entry><function>pg_catalog.pg_logdir_ls()</function></entry>
59+
<entry><type>setof record</type></entry>
60+
<entry>
61+
List the log files in the <varname>log_directory</> directory
62+
</entry>
63+
</row>
64+
</tbody>
65+
</tgroup>
66+
</table>
67+
68+
<indexterm>
69+
<primary>pg_file_write</primary>
70+
</indexterm>
71+
<para>
72+
<function>pg_file_write</> writes the specified <parameter>data</> into
73+
the file named by <parameter>filename</>. If <parameter>append</> is
74+
false, the file must not already exist. If <parameter>append</> is true,
75+
the file can already exist, and will be appended to if so.
76+
Returns the number of bytes written.
77+
</para>
78+
79+
<indexterm>
80+
<primary>pg_file_rename</primary>
81+
</indexterm>
82+
<para>
83+
<function>pg_file_rename</> renames a file. If <parameter>archivename</>
84+
is omitted or NULL, it simply renames <parameter>oldname</>
85+
to <parameter>newname</> (which must not already exist).
86+
If <parameter>archivename</> is provided, it first
87+
renames <parameter>newname</> to <parameter>archivename</> (which must
88+
not already exist), and then renames <parameter>oldname</>
89+
to <parameter>newname</>. In event of failure of the second rename step,
90+
it will try to rename <parameter>archivename</> back
91+
to <parameter>newname</> before reporting the error.
92+
Returns true on success, false if the source file(s) are not present or
93+
not writable; other cases throw errors.
94+
</para>
2395

24-
<programlisting>
25-
int8 pg_catalog.pg_file_write(fname text, data text, append bool)
26-
bool pg_catalog.pg_file_rename(oldname text, newname text, archivename text)
27-
bool pg_catalog.pg_file_rename(oldname text, newname text)
28-
bool pg_catalog.pg_file_unlink(fname text)
29-
setof record pg_catalog.pg_logdir_ls()
96+
<indexterm>
97+
<primary>pg_file_unlink</primary>
98+
</indexterm>
99+
<para>
100+
<function>pg_file_unlink</> removes the specified file.
101+
Returns true on success, false if the specified file is not present
102+
or the <function>unlink()</> call fails; other cases throw errors.
103+
</para>
104+
105+
<indexterm>
106+
<primary>pg_logdir_ls</primary>
107+
</indexterm>
108+
<para>
109+
<function>pg_logdir_ls</> returns the start timestamps and path
110+
names of all the log files in the <xref linkend="guc-log-directory">
111+
directory. The <xref linkend="guc-log-filename"> parameter must have its
112+
default setting (<literal>postgresql-%Y-%m-%d_%H%M%S.log</>) to use this
113+
function.
114+
</para>
115+
116+
<para>
117+
The functions shown
118+
in <xref linkend="functions-adminpack-deprecated-table"> are deprecated
119+
and should not be used in new applications; instead use those shown
120+
in <xref linkend="functions-admin-signal-table">
121+
and <xref linkend="functions-admin-genfile-table">. These functions are
122+
provided in <filename>adminpack</> only for compatibility with old
123+
versions of <application>pgAdmin</>.
124+
</para>
30125

31-
/* Renaming of existing backend functions for pgAdmin compatibility */
32-
int8 pg_catalog.pg_file_read(fname text, data text, append bool)
33-
bigint pg_catalog.pg_file_length(text)
34-
int4 pg_catalog.pg_logfile_rotate()
35-
</programlisting>
36-
</para>
126+
<table id="functions-adminpack-deprecated-table">
127+
<title>Deprecated <filename>adminpack</> Functions</title>
128+
<tgroup cols="3">
129+
<thead>
130+
<row><entry>Name</entry> <entry>Return Type</entry> <entry>Description</entry>
131+
</row>
132+
</thead>
37133

38-
</sect2>
134+
<tbody>
135+
<row>
136+
<entry><function>pg_catalog.pg_file_read(filename text, offset bigint, nbytes bigint)</function></entry>
137+
<entry><type>text</type></entry>
138+
<entry>
139+
Alternate name for <function>pg_read_file()</>
140+
</entry>
141+
</row>
142+
<row>
143+
<entry><function>pg_catalog.pg_file_length(filename text)</function></entry>
144+
<entry><type>bigint</type></entry>
145+
<entry>
146+
Same as <structfield>size</> column returned
147+
by <function>pg_stat_file()</>
148+
</entry>
149+
</row>
150+
<row>
151+
<entry><function>pg_catalog.pg_logfile_rotate()</function></entry>
152+
<entry><type>integer</type></entry>
153+
<entry>
154+
Alternate name for <function>pg_rotate_logfile()</>, but note that it
155+
returns integer 0 or 1 rather than boolean
156+
</entry>
157+
</row>
158+
</tbody>
159+
</tgroup>
160+
</table>
39161

40162
</sect1>

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp