BEGIN initiates a user transaction in chained mode,
i.e., all user statements after BEGIN command will
be executed in a single transaction until an explicit
- -title" endterm="sql-commit-title">,
- -title" endterm="sql-rollback-title">,
+ ,
+ ,
or execution abort. Statements in chained mode are executed much faster,
because transaction start/commit requires significant CPU and disk
activity. Execution of multiple statements inside a transaction
Notes
- Refer to -title" endterm="sql-lock-title">
+ Refer to
for further information
about locking tables inside a transaction.
- Use -TITLE" endterm="SQL-COMMIT-TITLE">
+ Use
or
- -TITLE" endterm="SQL-ROLLBACK-TITLE">
+
to terminate a transaction.
Specifies the alternative database location. See also
- linkend="app-initlocation" endterm="app-initlocation-title">.
+ linkend="app-initlocation">.
The options -h, -p, -U,
-W, and -e are passed on literally to
- APP-PSQL" endterm="APP-PSQL-title">.
+ app-psql">.
If there is an error condition, the backend error message will be displayed.
- See endterm="SQL-CREATEDATABASE-title">
- and endterm="APP-PSQL-title"> for possibilities.
+ See
+ and for possibilities.
via
the
Postgres interactive terminal
- endterm="APP-PSQL-title">. Thus, there is nothing
+ . Thus, there is nothing
special about creating databases via this or other methods. This means
that the
psql must be found by the script and that
a database server is running at the targeted host. Also, any default
Most error messages are self-explanatory. If not, run
createlang with the
option and see under the respective
SQL command
- for details. Check also under endterm="APP-PSQL-title">
+ for details. Check also under
for more possibilities.
Notes
- Use
- to remove a language.
+ Use to remove a language.
The options -h, -p, and -e,
- are passed on literally to endterm="APP-PSQL-title">. The
+ are passed on literally to . The
are available as well, but their use can be confusing in this context.
If there is an error condition, the backend error message will be displayed.
See
- and endterm="APP-PSQL-title"> for possibilities.
+ and for possibilities.
via
the
Postgres interactive terminal
- endterm="APP-PSQL-title">. Thus, there is nothing
+ . Thus, there is nothing
special about creating users via this or other methods. This means
that the
psql must be found by the script and that
a database server is running at the targeted host. Also, any default
can be used to retrieve
a small number of rows at a time out of a larger query. Cursors can
return data either in text or in binary format using
- -title" endterm="sql-fetch-title">.
+ .
Cursors are only available in transactions. Use to
- -title" endterm="sql-begin-title">,
- -title" endterm="sql-commit-title">
+ ,
+
and
- -title" endterm="sql-rollback-title">
+
to define a transaction block.
Use
- -title" endterm="sql-createaggregate-title">
+
to create aggregate functions.
Refer to
- -title" endterm="sql-createfunction-title">
+
for information on creating aggregate functions.
Refer to
- -title" endterm="sql-createindex-title">
+
for information on how to create indexes.
Refer to
- -title" endterm="sql-createlanguage-title">
+
for information on how to create procedural languages.
Refer to
- -title" endterm="sql-createoperator-title">
+
for information on how to create operators.
The options -h, -p, -U,
-W, and -e are passed on literally to
- endterm="APP-PSQL-title">.
+ .
If there is an error condition, the backend error message will be displayed.
See
- and endterm="APP-PSQL-title"> for possibilities.
+ and for possibilities.
via
the
Postgres interactive terminal
- endterm="APP-PSQL-title">. Thus, there is nothing
+ . Thus, there is nothing
special about dropping databases via this or other methods. This means
that the
psql must be found by the script and that
a database server is running at the targeted host. Also, any default
Most error messages are self-explanatory. If not, run
option and see under the respective
SQL command
- for details. Check also under endterm="APP-PSQL-title">
+ for details. Check also under
for more possibilities.
- Use
- to add a language.
+ Use to add a language.
The options -h, -p, and -e,
- are passed on literally to endterm="APP-PSQL-title">. The
+ are passed on literally to . The
are available as well, but they can be confusing in this context.
If there is an error condition, the backend error message will be displayed.
See
- and endterm="APP-PSQL-title"> for possibilities.
+ and for possibilities.
via
the
Postgres interactive terminal
- endterm="APP-PSQL-title">. Thus, there is nothing
+ . Thus, there is nothing
special about removing users via this or other methods. This means
that the
psql must be found by the script and that
a database server is running at the targeted host. Also, any default
+ 1
Application
-o
- Specifies that ecpg should write all its output to outfile.
+ Specifies that
ecpg should write all its output to outfile.
If no such option is given the output is written to
name.c,
assuming the input file was
return value
- ecpg returns 0 to the shell on successful completion, -1
+
ecpg returns 0 to the shell on successful completion, -1
for errors.
original author of
ecpg (up to version 0.2).
is the current author and maintainer of
ecpg.
- is the author of the last revision of the ecpg man page, on which
+ is the author of the last revision of the
ecpg man page, on which
this document is based.
Variable Declaration
- Variables declared within ecpg source code must be prepended with:
+ Variables declared within
ecpg source code must be prepended with:
EXEC SQL BEGIN DECLARE SECTION;
followed, i.e., using uppercase to separate embedded SQL
from C statements, sqlca (which includes the sqlca.h
header file) MUST be lowercase. This is because the EXEC SQL
- prefix indicates that this INCLUDE will be parsed by ecpg.
- ecpg observes case sensitivity (SQLCA.h will not be found).
+ prefix indicates that this INCLUDE will be parsed by
ecpg.
+
ecpg observes case sensitivity (SQLCA.h will not be found).
EXEC SQL INCLUDE
can be used to include other header files
as long as case sensitivity is observed.
extension, and is a synonym for the SQL92-compatible
- -title" endterm="sql-commit-title">.
+ .
- Use -TITLE" endterm="SQL-ROLLBACK-TITLE">
+ Use
to abort a transaction.
extension which provides functionality equivalent to
- -title" endterm="sql-commit-title">.
+ .
Use
- -title" endterm="sql-move-title">
+
to change cursor position.
- -title" endterm="sql-declare-title">
+
will define a cursor.
Refer to
- -title" endterm="sql-begin-title">,
- -title" endterm="sql-commit-title">,
+ ,
+ ,
and
- -title" endterm="sql-rollback-title">
+
for further information about transactions.
- 2000-11-11
+ 2000-12-25
Creating a database system consists of creating the directories in which
the database data will live, generating the shared catalog tables
- (tables that don't belong to any particular database), and
+ (tables that do not belong to any particular database), and
creating the template1
database. When you create a new database, everything in the
template1 database is copied.
-D dbdir
- This option specifies where in the file system the database should be
- stored. This is the only information required by initdb, but you can avoid
- it by setting the PGDATA environment variable, which
- can be convenient since the database server (postmaster)
- can find the database directory later by the same variable.
+ This option specifies where in the file system the database
+ should be stored. This is the only information required by
+
initdb, but you can avoid it by
+ setting the PGDATA environment variable, which
+ can be convenient since the database server
+ (postmaster) can find the database
+ directory later by the same variable.
-i sysid
- Selects the system id of the database superuser. This defaults to
- the effective user id of the user running initdb. It is really
- not important what the superuser's sysid is, but one might choose
- to start the numbering at some number like 1.
+ Selects the system id of the database superuser. This defaults
+ to the effective user id of the user running
+
initdb. It is really not important
+ what the superuser's sysid is, but one might choose to start
+ the numbering at some number like 1.
-W
- Makes initdb prompt for a password of the database superuser. If you
- don't plan on using password authentication, this is not important.
- Otherwise you won't be able to use password authentication until
- you have a password set up.
+ Makes
initdb prompt for a password
+ of the database superuser. If you don't plan on using password
+ authentication, this is not important. Otherwise you won't be
+ able to use password authentication until you have a password
+ set up.
-L directory
- Specifies where initdb should find its input files to
- initialize the database system. This is normally not
- necessary. You will be told if you need to specify their
- location explicitly.
+ Specifies where
initdb should find
+ its input files to initialize the database system. This is
+ normally not necessary. You will be told if you need to
+ specify their location explicitly.
Possible limitations in features of the
query
clause are documented for
- -title" endterm="sql-select-title">.
+ .
- -title" endterm="sql-notify-title">
+
contains a more extensive
discussion of the use of LISTEN and
NOTIFY.
There is no
LOCK TABLE in
SQL92,
which instead uses SET TRANSACTION to specify
concurrency levels on transactions. We support that too; see
- ITLE" endterm="SQL-SET-TITLE"> for details.
+ RANSACTION" endterm="SQL-SET-TRANSACTION-TITLE"> for details.
Refer to
- -title" endterm="sql-fetch-title">
+
for details on syntax and usage.
Refer to
- -title" endterm="sql-fetch-title">
+
for a description of valid arguments.
Refer to
- -title" endterm="sql-declare-title">
+
to define a cursor.
Refer to
- -title" endterm="sql-begin-title">,
- -title" endterm="sql-commit-title">,
+ ,
+ ,
and
- -title" endterm="sql-rollback-title">
+
for further information about transactions.
Description
pg_ctl is a utility for starting,
- stopping, or restarting the
- endterm="app-postmaster-title">, or displaying the status of a
- running postmaster.
+ stopping, or restarting the , or
+ displaying the status of a running postmaster.
+
+ 2000-12-25
+
+
+ 1
Application
and other architectures.\r
\r
- The archive files, new with this v7.1, contain enough information for \r
+ The archive files, new with version 7.1, contain enough information for \r
pg_restore to rebuild the database, but also
\r
allow pg_restore to be selective about what is restored, or even to \r
reorder the items prior to being restored. The archive files should \r
pg_dumpall is a utility for writing out
(dumping
) all Postgres databases of a cluster into
one script file. The script file contains SQL commands that can be
- used as input to endterm="app-psql-title">
+ used as input to
to restore the databases. It does this by calling
- linkend="app-pgdump" endterm="app-pgdump-title"> for each database
+ linkend="app-pgdump"> for each database
in a cluster.
pg_dumpall also dumps
global objects that are common to all databases.
(
pg_dump does not save these objects.)
Any other command line parameters are passed to the underlying
- endterm="app-pgdump-title" linkend="app-pgdump-title">
+ linkend="app-pgdump">
calls. This is useful to control some aspects of the output
format, but some options such as ,
, and
See Also
-
,
- linkend="app-psql" endterm="app-psql-title">. Check there for
- details on possible error conditions.
+ , . Check
+ there for details on possible error conditions.
- Supply the name of the password file as argument to the pg_passwd
+ Supply the name of the password file as argument to the
pg_passwd
command. To be of use for client authentication the file needs to
be location in the server's data directory, and the base name of
the file needs to be specified in the
- It is also useful to have entries in password file with an empty
+ It is also useful to have entries in a password file with an empty
password field. (This is different from an empty password.)
These entries cannot be managed by
pg_passwd, but it is always possible to
+ 1
Application
Another way of accessing
Postgres
through tcl is to use
- endterm="app-pgtclsh-title">
+
or
- endterm="app-pgtksh-title">.
+ .
+
+ 2000-12-25
+
+
+ 1
Application
-
- 1999-08-03
-
-
-pgtclsh [ dbname ]
-
+
+ pgtclsh
+
Another way of accessing
Postgres
through tcl is to use
- endterm="app-pgtksh-title">
+
or
- endterm="app-pgaccess-title">.
+ .
+
+ 2000-12-25
+
+
+ 1
Application
-
- 1999-08-03
-
-
-pgtksh [ dbname ]
-
+
+ pgtksh
+
Another way of accessing
Postgres
- endterm="app-pgtclsh-title">
+
or
- endterm="app-pgaccess-title">.
+ .
PostgreSQL server process that processes
queries. The second form above is how
postgres is invoked by the
- linkend="app-postmaster" endterm="app-postmaster-title"> (only
+ linkend="app-postmaster"> (only
conceptually, since both postmaster and
postgres are in fact the same program); it
should not be invoked directly this way. The first form invokes
the server directly in interactive mode. The primary use for this
- mode is for bootstrapping by
- endterm="app-initdb-title">.
+ mode is for bootstrapping by .
When
postgres is started by a
- linkend="app-postmaster" endterm="app-postmaster-title"> then it
+ linkend="app-postmaster"> then it
inherits all options set by the latter. Additionally,
postgres-specific options can be passed
from the
postmaster with the
The options , ,
, , ,
and
have the same meaning as with the
- linkend="app-postmaster" endterm="app-postmaster-title">.
+ linkend="app-postmaster">.
See also
- endterm="app-initdb-title">,
- endterm="app-ipcclean-title">,
- endterm="app-postmaster-title">
+ ,
+ ,
+
-APP-POSTMASTER">
+app-postmaster">
- 2000-11-30
+ 2000-12-25
(over a network or locally) to a running
postmaster then starts a separate server
- process (
- endterm="app-postgres-title">) to handle the connection.
- The postmaster also manages the communication among server
- processes.
+ process (
) to handle
+ the connection. The
postmaster also
+ manages the communication among server processes.
- By default the postmaster starts in the foreground and prints log
- messages to the standard output. In practical applications the
- postmaster should be started as a background process, perhaps at
- boot time.
+ By default the
postmaster starts in the
+ foreground and prints log messages to the standard output. In
+ p
ractical applications the postmaster
+ should be started as a background process, perhaps at boot time.
- One postmaster always manages the data from exactly one database
- cluster. A database cluster is a collection of databases that is
- stored at a common file system location. When the postmaster
- starts it needs to know the location of the database cluster files
- (data area
). This is done with the
- invocation option or the PGDATA
- environment variable; there is no default. More than one
- postmaster process can run on a system at one time, as long as they
- use different data areas and different communication ports (see below).
- A data area is created with
- endterm="app-initdb-title">.
+ One
postmaster always manages the data
+ from exactly one database cluster. A database cluster is a
+ collection of databases that is stored at a common file system
+ location. When the postmaster starts it needs to know the location
+ of the database cluster files (data area
). This is
+ done with the invocation option or the
+ PGDATA environment variable; there is no default.
+ More than one postmaster process can run on a system at one time,
+ as long as they use different data areas and different
+ communication ports (see below). A data area is created with
+ linkend="app-initdb">.
- -k directoryname
+ -k directory
Specifies the directory of the Unix-domain socket on which the
Sets the maximum number of client connections that this
- postmaster will accept. By default, this value is 32, but it
- can be set as high as 1024 if your system will support that
- many processes. (Note that is required to
- be at least twice .)
+
postmaster will accept. By
+ default, this value is 32, but it can be set as high as 1024
+ if your system will support that many processes. (Note that
+ is required to be at least twice
+ .)
The command line-style options specified in
- class="parameter">EXTRA-OPTIONS are passed to
+ class="parameter">extra-options are passed to
all backend server processes started by this
postmaster. See
- linkend="app-postgres" endterm="app-postgres-title"> for
- possibilities. If the option string contains any spaces, the
- entire string must be quoted.
+ linkend="app-postgres"> for possibilities. If the option
+ string contains any spaces, the entire string must be quoted.
Using this switch discards all logging output, which is
probably not what you want, since it makes it very difficult
to troubleshoot problems. See below for a better way to start
- the postmaster in the background.
+ the
postmaster in the background.
process already running on the same port number. The easiest way to
determine this is by using the command
-$ ps -ax | grep postmaster
- >
-on BSD-based systems, or
-$ ps -e | grep postmast
- >
- for System V-like or POSIX-compliant systems such as HP-UX.
+>
+
$ ps ax | grep postmaster
+>
+ or
+>
+
$ ps -e | grep postmaster
+>
+ depending on your system.
- To terminate the postmaster normally, the signals
- SIGTERM, SIGINT, or
- SIGQUIT can be used. The first will wait for
+ To terminate the
postmaster normally,
+ the signals SIGTERM, SIGINT,
+ or SIGQUIT can be used. The first will wait for
all clients to terminate before quitting, the second will
forcefully disconnect all clients, and the third will quit
immediately without lengthy shutdown, resulting in a recovery run
The utility command can be used to
- start and shut down the postmaster safely and comfortably.
+ start and shut down the
postmaster
+ safely and comfortably.
+
+ 2000-12-25
+
+
-
-
+ 1
Application
-
-
Postgres interactive terminal
The name of a run-time parameter. See
- linkend="sql-set-title" endterm="sql-set-title"> for a list.
+ linkend="sql-set" endterm="sql-set-title"> for a list.
RESET restores run-time parameters to their
default values. Refer to
- -title" endterm="sql-set-title">
+
for details. RESET is an alternate form for
Diagnostics
- See under the -title"
+ See under the
endterm="sql-set-title"> command.
Privilege to define rules on table/view.
(See
- -title" endterm="sql-createrule-title">).
+ ).
Refer to
- -title" endterm="sql-grant-title">
+
for details on individual fields.
Rescinds authority for a user to grant the specified privilege
to others.
Refer to
- -title" endterm="sql-grant-title">
+
for details on individual fields.
Notes
- Use -TITLE" endterm="SQL-COMMIT-TITLE">
+ Use
to successfully terminate a transaction.
- -TITLE" endterm="SQL-ABORT-TITLE"> is a
+ is a
synonym for ROLLBACK.
All input fields are described in detail for
- -title" endterm="sql-select-title">.
+ .
All output fields are described in detail for
- -title" endterm="sql-select-title">.
+ .
- -title" endterm="sql-createtableas-title">
+
is functionally equivalent to the SELECT INTO command.
The name of a run-time parameter. See
- -title" endterm="sql-set-title">
+
for a list.
- -title">
+
contains a more extensive
discussion of the use of LISTEN and
NOTIFY.
Array references use the same syntax found in
- -title" endterm="sql-select-title">.
+ .
That is, either single array elements, a range of array
elements or the entire array may be replaced with a single
query.
Something went wrong.
vacuumdb is only a wrapper
script. See
- and endterm="APP-PSQL-title"> for a detailed
+ and for a detailed
discussion of error messages and potential problems.
backend command
via
the
Postgres interactive terminal
- endterm="APP-PSQL-title">. There is no effective
+ . There is no effective
difference between vacuuming databases via this or other methods.
psql must be found by the script and
a database server must be running at the targeted host. Also, any default
-->
-
Client Applications
+
PostgreSQL Client Applications
-
Server Applications and Utilities
+
PostgreSQL Server Applications