version 1, including all changes.
.
Rev |
Author |
# |
Line |
1 |
perry |
1 |
POSTGRES |
|
|
2 |
!!!POSTGRES |
|
|
3 |
NAME |
|
|
4 |
SYNOPSIS |
|
|
5 |
DESCRIPTION |
|
|
6 |
USAGE |
|
|
7 |
SEE ALSO |
|
|
8 |
---- |
|
|
9 |
!!NAME |
|
|
10 |
|
|
|
11 |
|
|
|
12 |
postgres - run a PostgreSQL server in single-user mode |
|
|
13 |
!!SYNOPSIS |
|
|
14 |
|
|
|
15 |
|
|
|
16 |
__postgres__ [[ __-A 0__ | __1__ ] [[ __-B__ |
|
|
17 |
''nbuffers'' ] [[ __-c__ |
|
|
18 |
''name''__=__''value'' ] [[ __-d__ |
|
|
19 |
''debug-level'' ] [[ __-D__ ''datadir'' ] [[ |
|
|
20 |
__-e__ ] [[ __-E__ ] [[ __-f s__ | __i__ | |
|
|
21 |
__t__ | __n__ | __m__ | __h__ ] [[ __-F__ ] [[ |
|
|
22 |
__-i__ ] [[ __-N__ ] [[ __-o__ ''filename'' ] [[ |
|
|
23 |
__-O__ ] [[ __-P__ ] [[ __-s__ | __-t pa__ | |
|
|
24 |
__pl__ | __ex__ ] [[ __-S__ ''sort-mem'' ] [[ |
|
|
25 |
__-W__ ''seconds'' ] [[ |
|
|
26 |
__--__''name''__=__''value'' ] |
|
|
27 |
''database'' |
|
|
28 |
|
|
|
29 |
|
|
|
30 |
__postgres__ [[ __-A 0__ | __1__ ] [[ __-B__ |
|
|
31 |
''nbuffers'' ] [[ __-c__ |
|
|
32 |
''name''__=__''value'' ] [[ __-d__ |
|
|
33 |
''debug-level'' ] [[ __-D__ ''datadir'' ] [[ |
|
|
34 |
__-e__ ] [[ __-f s__ | __i__ | __t__ | __n__ | |
|
|
35 |
__m__ | __h__ ] [[ __-F__ ] [[ __-i__ ] [[ |
|
|
36 |
__-o__ ''filename'' ] [[ __-O__ ] [[ __-p__ |
|
|
37 |
''database'' ] [[ __-P__ ] [[ __-s__ | __-t pa__ | |
|
|
38 |
__pl__ | __ex__ ] [[ __-S__ ''sort-mem'' ] [[ |
|
|
39 |
__-v__ ''protocol-version'' ] [[ __-W__ |
|
|
40 |
''seconds'' ] [[ __--__''name''__=__''value'' |
|
|
41 |
] |
|
|
42 |
!!DESCRIPTION |
|
|
43 |
|
|
|
44 |
|
|
|
45 |
The ''postgres'' executable is the actual PostgreSQL |
|
|
46 |
server process that processes queries. It is normally not |
|
|
47 |
called directly; instead a postmaster(1) multi-user |
|
|
48 |
server is started. |
|
|
49 |
|
|
|
50 |
|
|
|
51 |
The second form above is how __postgres__ is invoked by |
|
|
52 |
the postmaster(1) (only conceptually, since both |
|
|
53 |
''postmaster'' and ''postgres'' are in fact the same |
|
|
54 |
program); it should not be invoked directly this way. The |
|
|
55 |
first form invokes the server directly in interactive |
|
|
56 |
single-user mode. The primary use for this mode is during |
|
|
57 |
bootstrapping by initdb(1). Sometimes it is used for |
|
|
58 |
debugging or disaster recovery. |
|
|
59 |
|
|
|
60 |
|
|
|
61 |
When invoked in interactive mode from the shell, the user |
|
|
62 |
can enter queries and the results will be printed to the |
|
|
63 |
screen, but in a form that is more useful for developers |
|
|
64 |
than end users. But note that running a single-user backend |
|
|
65 |
is not truly suitable for debugging the server since no |
|
|
66 |
realistic interprocess communication and locking will |
|
|
67 |
happen. |
|
|
68 |
|
|
|
69 |
|
|
|
70 |
When running a stand-alone backend, the session user will be |
|
|
71 |
set to the user with id 1. This user does not actually have |
|
|
72 |
to exist, so a stand-alone backend can be used to manually |
|
|
73 |
recover from certain kinds of accidental damage to the |
|
|
74 |
system catalogs. Implicit superuser powers are granted to |
|
|
75 |
the user with id 1 in stand-alone mode. |
|
|
76 |
|
|
|
77 |
|
|
|
78 |
__OPTIONS__ |
|
|
79 |
|
|
|
80 |
|
|
|
81 |
When __postgres__ is started by a postmaster(1) |
|
|
82 |
then it inherits all options set by the latter. |
|
|
83 |
Additionally, __postgres__-specific options can be passed |
|
|
84 |
from the __postmaster__ with the __-o__ |
|
|
85 |
switch. |
|
|
86 |
|
|
|
87 |
|
|
|
88 |
You can avoid having to type these options by setting up a |
|
|
89 |
configuration file. See the ''Administrator's Guide'' for |
|
|
90 |
details. Some (safe) options can also be set from the |
|
|
91 |
connecting client in an application-dependent way. For |
|
|
92 |
example, if the environment variable __PGOPTIONS__ is |
|
|
93 |
set, then libpq-based clients will pass that string to the |
|
|
94 |
server, which will interpret it as __postgres__ |
|
|
95 |
command-line options. |
|
|
96 |
|
|
|
97 |
|
|
|
98 |
__GENERAL PURPOSE__ |
|
|
99 |
|
|
|
100 |
|
|
|
101 |
The options __-A__, __-B__, __-c__, __-d__, |
|
|
102 |
__-D__, __-F__, and __--name__ have the same |
|
|
103 |
meanings as for the postmaster(1). |
|
|
104 |
|
|
|
105 |
|
|
|
106 |
__-e__ |
|
|
107 |
|
|
|
108 |
|
|
|
109 |
Sets the default date style to ``European'', which means |
|
|
110 |
that the ``day before month'' (rather than month before day) |
|
|
111 |
rule is used to interpret ambiguous date input, and that the |
|
|
112 |
day is printed before the month in certain date output |
|
|
113 |
formats. See the ''PostgreSQL User's Guide'' for more |
|
|
114 |
information. |
|
|
115 |
|
|
|
116 |
|
|
|
117 |
__-o__ ''filename'' |
|
|
118 |
|
|
|
119 |
|
|
|
120 |
Sends all debugging and error output to ''filename''. If |
|
|
121 |
the backend is running under the __postmaster__, this |
|
|
122 |
option is ignored, and the stderr inherited from the |
|
|
123 |
__postmaster__ is used. |
|
|
124 |
|
|
|
125 |
|
|
|
126 |
__-P__ |
|
|
127 |
|
|
|
128 |
|
|
|
129 |
Ignore system indexes while scanning/updating system tuples. |
|
|
130 |
The __REINDEX__ command for system tables/indexes |
|
|
131 |
requires this option to be used. |
|
|
132 |
|
|
|
133 |
|
|
|
134 |
__-s__ |
|
|
135 |
|
|
|
136 |
|
|
|
137 |
Print time information and other statistics at the end of |
|
|
138 |
each query. This is useful for benchmarking or for use in |
|
|
139 |
tuning the number of buffers. |
|
|
140 |
|
|
|
141 |
|
|
|
142 |
__-S__ ''sort-mem'' |
|
|
143 |
|
|
|
144 |
|
|
|
145 |
Specifies the amount of memory to be used by internal sorts |
|
|
146 |
and hashes before resorting to temporary disk files. The |
|
|
147 |
value is specified in kilobytes, and defaults to 512 |
|
|
148 |
kilobytes. Note that for a complex query, several sorts |
|
|
149 |
and/or hashes might be running in parallel, and each one |
|
|
150 |
will be allowed to use as much as ''sort-mem'' kilobytes |
|
|
151 |
before it starts to put data into temporary |
|
|
152 |
files. |
|
|
153 |
|
|
|
154 |
|
|
|
155 |
__OPTIONS FOR STAND-ALONE MODE__ |
|
|
156 |
|
|
|
157 |
|
|
|
158 |
''database'' |
|
|
159 |
|
|
|
160 |
|
|
|
161 |
Specifies the name of the database to be accessed. If it is |
|
|
162 |
omitted it defaults to the user name. |
|
|
163 |
|
|
|
164 |
|
|
|
165 |
__-E__ |
|
|
166 |
|
|
|
167 |
|
|
|
168 |
Echo all queries. |
|
|
169 |
|
|
|
170 |
|
|
|
171 |
__-N__ |
|
|
172 |
|
|
|
173 |
|
|
|
174 |
Disables use of newline as a query delimiter. |
|
|
175 |
|
|
|
176 |
|
|
|
177 |
__SEMI-INTERNAL OPTIONS__ |
|
|
178 |
|
|
|
179 |
|
|
|
180 |
There are several other options that may be specified, used |
|
|
181 |
mainly for debugging purposes. These are listed here only |
|
|
182 |
for the use by PostgreSQL system developers. __Use of any |
|
|
183 |
of these options is highly discouraged.__ Furthermore, any |
|
|
184 |
of these options may disappear or change in a future release |
|
|
185 |
without notice. |
|
|
186 |
|
|
|
187 |
|
|
|
188 |
__-f { s | i | m | n | h }__ |
|
|
189 |
|
|
|
190 |
|
|
|
191 |
Forbids the use of particular scan and join methods: s and i |
|
|
192 |
disable sequential and index scans respectively, while n, m, |
|
|
193 |
and h disable nested-loop, merge and hash joins |
|
|
194 |
respectively. |
|
|
195 |
|
|
|
196 |
|
|
|
197 |
__Note:__ Neither sequential scans nor nested-loop joins |
|
|
198 |
can be disabled completely; the -fs and -fn options simply |
|
|
199 |
discourage the optimizer from using those plan types if it |
|
|
200 |
has any other alternative. |
|
|
201 |
|
|
|
202 |
|
|
|
203 |
__-i__ |
|
|
204 |
|
|
|
205 |
|
|
|
206 |
Prevents query execution, but shows the plan |
|
|
207 |
tree. |
|
|
208 |
|
|
|
209 |
|
|
|
210 |
__-O__ |
|
|
211 |
|
|
|
212 |
|
|
|
213 |
Allows the structure of system tables to be modified. This |
|
|
214 |
is used by __initdb__. |
|
|
215 |
|
|
|
216 |
|
|
|
217 |
__-p__ ''database'' |
|
|
218 |
|
|
|
219 |
|
|
|
220 |
Indicates that this server has been started by a |
|
|
221 |
__postmaster__ and makes different assumptions about |
|
|
222 |
buffer pool management, file descriptors, etc. |
|
|
223 |
|
|
|
224 |
|
|
|
225 |
__-t pa[[rser] | pl[[anner] | e[[xecutor]__ |
|
|
226 |
|
|
|
227 |
|
|
|
228 |
Print timing statistics for each query relating to each of |
|
|
229 |
the major system modules. This option cannot be used |
|
|
230 |
together with the __-s__ option. |
|
|
231 |
|
|
|
232 |
|
|
|
233 |
__-v__ ''protocol'' |
|
|
234 |
|
|
|
235 |
|
|
|
236 |
Specifies the version number of the frontend/backend |
|
|
237 |
protocol to be used for this particular |
|
|
238 |
session. |
|
|
239 |
|
|
|
240 |
|
|
|
241 |
__-W__ ''seconds'' |
|
|
242 |
|
|
|
243 |
|
|
|
244 |
As soon as this option is encountered, the process sleeps |
|
|
245 |
for the specified amount of seconds. This gives developers |
|
|
246 |
time to attach a debugger to the backend |
|
|
247 |
process. |
|
|
248 |
!!USAGE |
|
|
249 |
|
|
|
250 |
|
|
|
251 |
Start a stand-alone backend with a command like |
|
|
252 |
|
|
|
253 |
|
|
|
254 |
__postgres -D $PGDATA__ ''other-options'' __my_database |
|
|
255 |
__Provide the correct path to the database area with __-D__, or make sure that the environment variable __PGDATA__ is set. Also specify the name of the particular database you want to work in. |
|
|
256 |
|
|
|
257 |
|
|
|
258 |
Normally, the stand-alone backend treats newline as the |
|
|
259 |
command entry terminator; there is no intelligence about |
|
|
260 |
semicolons, as there is in __psql__. To continue a |
|
|
261 |
command across multiple lines, you must type backslash just |
|
|
262 |
before each newline except the last one. |
|
|
263 |
|
|
|
264 |
|
|
|
265 |
But if you use the __-N__ command line switch, then |
|
|
266 |
newline does not terminate command entry. The backend will |
|
|
267 |
read the standard input until the end-of-file (EOF) marker, |
|
|
268 |
then process the input as a single query string. |
|
|
269 |
Backslash-newline is not treated specially in this |
|
|
270 |
case. |
|
|
271 |
|
|
|
272 |
|
|
|
273 |
To quit the session, type EOF (__Control__+__D__, |
|
|
274 |
usually). If you've used __-N__, two consecutive EOFs are |
|
|
275 |
needed to exit. |
|
|
276 |
|
|
|
277 |
|
|
|
278 |
Note that the stand-alone backend does not provide |
|
|
279 |
sophisticated line-editing features (no command history, for |
|
|
280 |
example). |
|
|
281 |
!!SEE ALSO |
|
|
282 |
|
|
|
283 |
|
|
|
284 |
initdb(1), ipcclean(1), |
|
|
285 |
postmaster(1) |
|
|
286 |
---- |