.\\" auto-generated by docbook2man-spec $Revision: 1.25 $ .TH "POSTGRES" "1" "2002-11-22" "Application" "PostgreSQL Server Applications" .SH NAME postgres \- run a PostgreSQL server in single-user mode .SH SYNOPSIS .sp \fBpostgres\fR\fR [ \fR\fB-A \fR\fB 0\fR | \fB1\fR\fB \fR\fR]\fR\fR [ \fR\fB-B \fInbuffers\fB \fR\fR]\fR\fR [ \fR\fB-c \fIname\fB=\fIvalue\fB \fR\fR]\fR\fR [ \fR\fB-d \fIdebug-level\fB \fR\fR]\fR\fR [ \fR\fB-D \fIdatadir\fB \fR\fR]\fR\fR [ \fR\fB-e \fR\fR]\fR\fR [ \fR\fB-E \fR\fR]\fR\fR [ \fR\fB-f \fR\fB s\fR | \fBi\fR | \fBt\fR | \fBn\fR | \fBm\fR | \fBh\fR\fB \fR\fR]\fR\fR [ \fR\fB-F \fR\fR]\fR\fR [ \fR\fB-i \fR\fR]\fR\fR [ \fR\fB-N \fR\fR]\fR\fR [ \fR\fB-o \fIfilename\fB \fR\fR]\fR\fR [ \fR\fB-O \fR\fR]\fR\fR [ \fR\fB-P \fR\fR]\fR \fR[\fR \fB-s\fR\fR | \fR\fB-t \fR\fB pa\fR | \fBpl\fR | \fBex\fR\fB\fR\fR ]\fR\fR [ \fR\fB-S \fIsort-mem\fB \fR\fR]\fR\fR [ \fR\fB-W \fIseconds\fB \fR\fR]\fR\fR [ \fR\fB--\fIname\fB=\fIvalue\fB \fR\fR]\fR \fB\fIdatabase\fB\fR \fBpostgres\fR\fR [ \fR\fB-A \fR\fB 0\fR | \fB1\fR\fB \fR\fR]\fR\fR [ \fR\fB-B \fInbuffers\fB \fR\fR]\fR\fR [ \fR\fB-c \fIname\fB=\fIvalue\fB \fR\fR]\fR\fR [ \fR\fB-d \fIdebug-level\fB \fR\fR]\fR\fR [ \fR\fB-D \fIdatadir\fB \fR\fR]\fR\fR [ \fR\fB-e \fR\fR]\fR\fR [ \fR\fB-f \fR\fB s\fR | \fBi\fR | \fBt\fR | \fBn\fR | \fBm\fR | \fBh\fR\fB \fR\fR]\fR\fR [ \fR\fB-F \fR\fR]\fR\fR [ \fR\fB-i \fR\fR]\fR\fR [ \fR\fB-o \fIfilename\fB \fR\fR]\fR\fR [ \fR\fB-O \fR\fR]\fR\fR [ \fR\fB-p \fIdatabase\fB \fR\fR]\fR\fR [ \fR\fB-P \fR\fR]\fR \fR[\fR \fB-s\fR\fR | \fR\fB-t \fR\fB pa\fR | \fBpl\fR | \fBex\fR\fB\fR\fR ]\fR\fR [ \fR\fB-S \fIsort-mem\fB \fR\fR]\fR\fR [ \fR\fB-v \fIprotocol-version\fB \fR\fR]\fR\fR [ \fR\fB-W \fIseconds\fB \fR\fR]\fR\fR [ \fR\fB--\fIname\fB=\fIvalue\fB \fR\fR]\fR .SH "DESCRIPTION" .PP The \fIpostgres\fR executable is the actual PostgreSQL server process that processes queries. It is normally not called directly; instead a \fBpostmaster\fR(1) multiuser server is started. .PP The second form above is how \fBpostgres\fR is invoked by the \fBpostmaster\fR(1) (only conceptually, since both \fIpostmaster\fR and \fIpostgres\fR are in fact the same program); it should not be invoked directly this way. The first form invokes the server directly in interactive single-user mode. The primary use for this mode is during bootstrapping by \fBinitdb\fR(1). Sometimes it is used for debugging or disaster recovery. .PP When invoked in interactive mode from the shell, the user can enter queries and the results will be printed to the screen, but in a form that is more useful for developers than end users. But note that running a single-user backend is not truly suitable for debugging the server since no realistic interprocess communication and locking will happen. .PP When running a stand-alone backend, the session user will be set to the user with ID 1. This user does not actually have to exist, so a stand-alone backend can be used to manually recover from certain kinds of accidental damage to the system catalogs. Implicit superuser powers are granted to the user with ID 1 in stand-alone mode. .SH "OPTIONS" .PP When \fBpostgres\fR is started by a \fBpostmaster\fR(1) then it inherits all options set by the latter. Additionally, \fBpostgres\fR-specific options can be passed from the \fBpostmaster\fR with the \fB-o\fR switch. .PP You can avoid having to type these options by setting up a configuration file. See the \fIAdministrator's Guide\fR for details. Some (safe) options can also be set from the connecting client in an application-dependent way. For example, if the environment variable \fBPGOPTIONS\fR is set, then \fBlibpq\fR-based clients will pass that string to the server, which will interpret it as \fBpostgres\fR command-line options. .SS "GENERAL PURPOSE" .PP The options \fB-A\fR, \fB-B\fR, \fB-c\fR, \fB-d\fR, \fB-D\fR, \fB-F\fR, and \fB--name\fR have the same meanings as the \fBpostmaster\fR(1) except that \fB-d\fR 0 prevents the debugging level of the postmaster from being propagated to the backend. .TP \fB-e\fR Sets the default date style to ``European'', which means that the ``day before month'' (rather than month before day) rule is used to interpret ambiguous date input, and that the day is printed before the month in certain date output formats. See the \fIPostgreSQL User's Guide\fR for more information. .TP \fB-o \fIfilename\fB\fR Sends all debugging and error output to \fIfilename\fR. If the backend is running under the \fBpostmaster\fR, this option is ignored, and the \fBstderr\fR inherited from the \fBpostmaster\fR is used. .TP \fB-P\fR Ignore system indexes while scanning/updating system tuples. The \fBREINDEX\fR command for system tables/indexes requires this option to be used. .TP \fB-s\fR Print time information and other statistics at the end of each query. This is useful for benchmarking or for use in tuning the number of buffers. .TP \fB-S \fIsort-mem\fB\fR Specifies the amount of memory to be used by internal sorts and hashes before resorting to temporary disk files. The value is specified in kilobytes, and defaults to 512 kilobytes. Note that for a complex query, several sorts and/or hashes might be running in parallel, and each one will be allowed to use as much as \fIsort-mem\fR kilobytes before it starts to put data into temporary files. .SS "OPTIONS FOR STAND-ALONE MODE" .TP \fB\fIdatabase\fB\fR Specifies the name of the database to be accessed. If it is omitted it defaults to the user name. .TP \fB-E\fR Echo all queries. .TP \fB-N\fR Disables use of newline as a query delimiter. .SS "SEMI-INTERNAL OPTIONS" .PP There are several other options that may be specified, used mainly for debugging purposes. These are listed here only for the use by PostgreSQL system developers. \fBUse of any of these options is highly discouraged.\fR Furthermore, any of these options may disappear or change in a future release without notice. .TP \fB-f { s | i | m | n | h }\fR Forbids the use of particular scan and join methods: s and i disable sequential and index scans respectively, while n, m, and h disable nested-loop, merge and hash joins respectively. .sp .RS .B "Note:" Neither sequential scans nor nested-loop joins can be disabled completely; the -fs and -fn options simply discourage the optimizer from using those plan types if it has any other alternative. .RE .sp .TP \fB-i\fR Prevents query execution, but shows the plan tree. .TP \fB-O\fR Allows the structure of system tables to be modified. This is used by \fBinitdb\fR. .TP \fB-p \fIdatabase\fB\fR Indicates that this server has been started by a \fBpostmaster\fR and makes different assumptions about buffer pool management, file descriptors, etc. .TP \fB-t pa[rser] | pl[anner] | e[xecutor]\fR Print timing statistics for each query relating to each of the major system modules. This option cannot be used together with the \fB-s\fR option. .TP \fB-v \fIprotocol\fB\fR Specifies the version number of the frontend/backend protocol to be used for this particular session. .TP \fB-W \fIseconds\fB\fR As soon as this option is encountered, the process sleeps for the specified amount of seconds. This gives developers time to attach a debugger to the backend process. .SH "ENVIRONMENT" .TP \fBPGDATA\fR Default data direction location .PP For others, which have little influence during single-user mode, see \fBpostmaster\fR(1). .PP .SH "NOTES" .PP To stop a running query use the SIGINT signal. To tell \fBpostgres\fR to reread the config file, use a SIGHUP signal. The \fBpostmaster\fR uses SIGTERM to tell a postgres process to quit normally and SIGQUIT to terminate without the normal cleanup. These \fBshould not\fR be used by users. .SH "USAGE" .PP Start a stand-alone backend with a command like .sp .nf \fBpostgres -D $PGDATA \fIother-options\fB my_database\fR .sp .fi Provide the correct path to the database area with \fB-D\fR, or make sure that the environment variable \fBPGDATA\fR is set. Also specify the name of the particular database you want to work in. .PP Normally, the stand-alone backend treats newline as the command entry terminator; there is no intelligence about semicolons, as there is in \fBpsql\fR. To continue a command across multiple lines, you must type backslash just before each newline except the last one. .PP But if you use the \fB-N\fR command line switch, then newline does not terminate command entry. The backend will read the standard input until the end-of-file (EOF) marker, then process the input as a single query string. Backslash-newline is not treated specially in this case. .PP To quit the session, type EOF (\fBControl\fR+\fBD\fR, usually). If you've used \fB-N\fR, two consecutive EOFs are needed to exit. .PP Note that the stand-alone backend does not provide sophisticated line-editing features (no command history, for example). .SH "SEE ALSO" .PP \fBinitdb\fR(1), \fBipcclean\fR(1), \fBpostmaster\fR(1)