- endterm="SQL-CREATEROLE-title">.
this utility and via other methods for accessing the server.
- id="sql-deallocate-title">DEALLOCATE
+ DEALLOCATE
7
SQL - Language Statements
For more information on prepared statements, see
- linkend="sql-prepare" endterm="sql-prepare-title">.
+ linkend="sql-prepare">.
See Also
- endterm="sql-execute-title">
- endterm="sql-prepare-title">
+
+
- id="SQL-DECLARE-TITLE">DECLARE
+ DECLARE
7
SQL - Language Statements
can be used to retrieve
a small number of rows at a time out of a larger query.
After the cursor is created, rows are fetched from it using
- endterm="sql-fetch-title">.
+ .
query
- A endterm="sql-select-title"> or
- endterm="sql-values-title"> command
+ A or
+ command
which will provide the rows to be returned by the cursor.
PostgreSQL reports an error if such a
command is used outside a transaction block.
Use
- endterm="sql-begin-title"> and
- endterm="sql-commit-title">
- (or endterm="sql-rollback-title">)
+ and
+
+ (or )
to define a transaction block.
If the cursor's query includes FOR UPDATE> or FOR
SHARE>, then returned rows are locked at the time they are first
fetched, in the same way as for a regular
- endterm="sql-select-title"> command with
+ command with
these options.
In addition, the returned rows will be the most up-to-date versions;
therefore these options provide the equivalent of what the SQL standard
DECLARE liahona CURSOR FOR SELECT * FROM films;
- See endterm="sql-fetch-title"> for more
+ See for more
examples of cursor usage.
See Also
- endterm="sql-close-title">
- endterm="sql-fetch-title">
- endterm="sql-move-title">
+
+
+
- id="SQL-DELETE-TITLE">DELETE
+ DELETE
7
SQL - Language Statements
- endterm="sql-truncate-title"> is a
+ is a
PostgreSQL extension that provides a
faster mechanism to remove all rows from a table.
query on the DELETE>'s target table.
Note that WHERE CURRENT OF> cannot be
specified together with a Boolean condition. See
- endterm="sql-declare-title">
+
for more information about using cursors with
WHERE CURRENT OF>.
- id="SQL-DISCARD-TITLE">DISCARD
+ DISCARD
7
SQL - Language Statements
- id="sql-do-title">DO
+ DO
7
SQL - Language Statements
See Also
- endterm="sql-createlanguage-title">
+
- id="SQL-DROPAGGREGATE-TITLE">DROP AGGREGATE
+ DROP AGGREGATE
7
SQL - Language Statements
See Also
- endterm="sql-alteraggregate-title">
- endterm="sql-createaggregate-title">
+
+
-
+
- id="SQL-DROPCAST-TITLE">DROP CAST
+ DROP CAST
7
SQL - Language Statements
See Also
- endterm="sql-createcast-title">
+
-
+
- id="SQL-DROPCONVERSION-TITLE">DROP CONVERSION
+ DROP CONVERSION
7
SQL - Language Statements
See Also
- endterm="sql-alterconversion-title">
- endterm="sql-createconversion-title">
+
+
- id="SQL-DROPDATABASE-TITLE">DROP DATABASE
+ DROP DATABASE
7
SQL - Language Statements
This command cannot be executed while connected to the target
database. Thus, it might be more convenient to use the program
- endterm="app-dropdb-title"> instead,
+ instead,
which is a wrapper around this command.
See Also
- endterm="sql-createdatabase-title">
+
- id="SQL-DROPDOMAIN-TITLE">DROP DOMAIN
+ DROP DOMAIN
7
SQL - Language Statements
See Also
- endterm="sql-createdomain-title">
- endterm="sql-alterdomain-title">
+
+
- id="sql-dropforeigndatawrapper-title">DROP FOREIGN DATA WRAPPER
+ DROP FOREIGN DATA WRAPPER
7
SQL - Language Statements
See Also
- endterm="sql-createforeigndatawrapper-title">
- endterm="sql-alterforeigndatawrapper-title">
+
+
- id="SQL-DROPFUNCTION-TITLE">DROP FUNCTION
+ DROP FUNCTION
7
SQL - Language Statements
See Also
- endterm="sql-createfunction-title">
- endterm="sql-alterfunction-title">
+
+
- id="SQL-DROPGROUP-TITLE">DROP GROUP
+ DROP GROUP
7
SQL - Language Statements
DROP GROUP is now an alias for
- endterm="sql-droprole-title">.
+ .
See Also
- endterm="sql-droprole-title">
+
- id="SQL-DROPINDEX-TITLE">DROP INDEX
+ DROP INDEX
7
SQL - Language Statements
See Also
- endterm="sql-createindex-title">
+
- id="SQL-DROPLANGUAGE-TITLE">DROP LANGUAGE
+ DROP LANGUAGE
7
SQL - Language Statements
See Also
- endterm="sql-alterlanguage-title">
- endterm="sql-createlanguage-title">
+
+
- id="SQL-DROPOPCLASS-TITLE">DROP OPERATOR CLASS
+ DROP OPERATOR CLASS
7
SQL - Language Statements
See Also
- endterm="sql-alteropclass-title">
- endterm="sql-createopclass-title">
- endterm="sql-dropopfamily-title">
+
+
+
- id="SQL-DROPOPERATOR-TITLE">DROP OPERATOR
+ DROP OPERATOR
7
SQL - Language Statements
See Also
- endterm="sql-createoperator-title">
- endterm="sql-alteroperator-title">
+
+
- id="SQL-DROPOPFAMILY-TITLE">DROP OPERATOR FAMILY
+ DROP OPERATOR FAMILY
7
SQL - Language Statements
See Also
- endterm="sql-alteropfamily-title">
- endterm="sql-createopfamily-title">
- endterm="sql-alteropclass-title">
- endterm="sql-createopclass-title">
- endterm="sql-dropopclass-title">
+
+
+
+
+
- id="SQL-DROP-OWNED-TITLE">DROP OWNED
+ DROP OWNED
7
SQL - Language Statements
- The
- endterm="sql-reassign-owned-title"> command is an alternative that
+ The command is an alternative that
reassigns the ownership of all the database objects owned by one or
more roles.
See Also
- endterm="sql-reassign-owned-title">
- endterm="sql-droprole-title">
+
+
- id="SQL-DROPROLE-TITLE">DROP ROLE
+ DROP ROLE
7
SQL - Language Statements
of the cluster; an error will be raised if so. Before dropping the role,
you must drop all the objects it owns (or reassign their ownership)
and revoke any privileges the role has been granted. The
- linkend="sql-reassign-owned" endterm="sql-reassign-owned-title">
- and endterm="sql-drop-owned-title">
+ linkend="sql-reassign-owned">
+ and
commands can be useful for this purpose.
PostgreSQL includes a program
- linkend="APP-DROPUSER" endterm="APP-DROPUSER-title"> that has the
+ linkend="APP-DROPUSER"> that has the
same functionality as this command (in fact, it calls this command)
but can be run from the command shell.
See Also
- endterm="sql-createrole-title">
- endterm="sql-alterrole-title">
- endterm="sql-set-role-title">
+
+
+
- id="SQL-DROPRULE-TITLE">DROP RULE
+ DROP RULE
7
SQL - Language Statements
See Also
- endterm="sql-createrule-title">
+
- id="SQL-DROPSCHEMA-TITLE">DROP SCHEMA
+ DROP SCHEMA
7
SQL - Language Statements
See Also
- endterm="sql-alterschema-title">
- endterm="sql-createschema-title">
+
+
- id="SQL-DROPSEQUENCE-TITLE">DROP SEQUENCE
+ DROP SEQUENCE
7
SQL - Language Statements
See Also
- endterm="sql-createsequence-title">
- endterm="sql-altersequence-title">
+
+
- id="sql-dropserver-title">DROP SERVER
+ DROP SERVER
7
SQL - Language Statements
See Also
- endterm="sql-createserver-title">
- endterm="sql-alterserver-title">
+
+
- id="SQL-DROPTABLE-TITLE">DROP TABLE
+ DROP TABLE
7
SQL - Language Statements
DROP TABLE removes tables from the database.
Only its owner can drop a table. To empty a table of rows
- without destroying the table, use
- endterm="sql-delete-title"> or
- endterm="sql-truncate-title">.
+ without destroying the table, use
+ or .
See Also
- endterm="sql-altertable-title">
- endterm="sql-createtable-title">
+
+
- id="SQL-DROPTABLESPACE-TITLE">DROP TABLESPACE
+ DROP TABLESPACE
7
SQL - Language Statements
See Also
- endterm="sql-createtablespace-title">
- endterm="sql-altertablespace-title">
+
+
- id="SQL-DROPTRIGGER-TITLE">DROP TRIGGER
+ DROP TRIGGER
7
SQL - Language Statements
See Also
- endterm="sql-createtrigger-title">
+
- id="SQL-DROPTSCONFIG-TITLE">DROP TEXT SEARCH CONFIGURATION
+ DROP TEXT SEARCH CONFIGURATION
7
SQL - Language Statements
See Also
- endterm="sql-altertsconfig-title">
- endterm="sql-createtsconfig-title">
+
+
- id="SQL-DROPTSDICTIONARY-TITLE">DROP TEXT SEARCH DICTIONARY
+ DROP TEXT SEARCH DICTIONARY
7
SQL - Language Statements
See Also
- endterm="sql-altertsdictionary-title">
- endterm="sql-createtsdictionary-title">
+
+
- id="SQL-DROPTSPARSER-TITLE">DROP TEXT SEARCH PARSER
+ DROP TEXT SEARCH PARSER
7
SQL - Language Statements
See Also
- endterm="sql-altertsparser-title">
- endterm="sql-createtsparser-title">
+
+
- id="SQL-DROPTSTEMPLATE-TITLE">DROP TEXT SEARCH TEMPLATE
+ DROP TEXT SEARCH TEMPLATE
7
SQL - Language Statements
See Also
- endterm="sql-altertstemplate-title">
- endterm="sql-createtstemplate-title">
+
+
- id="SQL-DROPTYPE-TITLE">DROP TYPE
+ DROP TYPE
7
SQL - Language Statements
See Also
- endterm="sql-createtype-title">
- endterm="sql-altertype-title">
+
+
- id="SQL-DROPUSER-TITLE">DROP USER
+ DROP USER
7
SQL - Language Statements
DROP USER is now an alias for
- endterm="sql-droprole-title">.
+ .
See Also
- endterm="sql-droprole-title">
+
- id="sql-dropusermapping-title">DROP USER MAPPING
+ DROP USER MAPPING
7
SQL - Language Statements
See Also
- endterm="sql-createusermapping-title">
- endterm="sql-alterusermapping-title">
+
+
- id="SQL-DROPVIEW-TITLE">DROP VIEW
+ DROP VIEW
7
SQL - Language Statements
See Also
- endterm="sql-alterview-title">
- endterm="sql-createview-title">
+
+
-
id="APP-DROPDB-TITLE">dropdb
1
Application
dropdb is a wrapper around the
-
SQL command
- endterm="SQL-DROPDATABASE-title">.
There is no effective difference between dropping databases via
this utility and via other methods for accessing the server.
Diagnostics
- In case of difficulty, see
- endterm="sql-dropdatabase-title"> and for
+ In case of difficulty, see >
+ and for
discussions of potential problems and error messages.
The database server must be running at the
targeted host. Also, any default connection settings and environment
- endterm="sql-dropdatabase-title">
+
-
id="APP-DROPLANG-TITLE">droplang
1
Application
several
SQL commands, it is recommended to use
droplang because it performs a number
of checks and is much easier to use. See
- endterm="sql-droplanguage-title">
+
for more.
- endterm="sql-droplanguage-title">
+
-
id="APP-DROPUSER-TITLE">dropuser
1
Application
dropuser is a wrapper around the
-
SQL command
- endterm="SQL-DROPROLE-title">.
There is no effective difference between dropping users via
this utility and via other methods for accessing the server.
Diagnostics
- In case of difficulty, see
- endterm="sql-droprole-title"> and for
+ In case of difficulty, see >
+ and for
discussions of potential problems and error messages.
The database server must be running at the
targeted host. Also, any default connection settings and environment
- endterm="sql-droprole-title">
+
- id="SQL-END-TITLE">END
+ END
7
SQL - Language Statements
made by the transaction become visible to others and are guaranteed
to be durable if a crash occurs. This command is a
- that is equivalent to
- endterm="sql-commit-title">.
+ that is equivalent to .
Notes
- Use endterm="SQL-ROLLBACK-TITLE"> to
+ Use to
abort a transaction.
extension that provides functionality equivalent to
- linkend="sql-commit" endterm="sql-commit-title">, which is
+ linkend="sql-commit">, which is
specified in the SQL standard.
See Also
- endterm="sql-begin-title">
- endterm="sql-commit-title">
- endterm="sql-rollback-title">
+
+
+
- id="sql-execute-title">EXECUTE
+ EXECUTE
7
SQL - Language Statements
For more information on the creation and usage of prepared statements,
- see endterm="sql-prepare-title">.
+ see .
Examples are given in the
endterm="sql-prepare-examples-title"> section of the
- linkend="sql-prepare" endterm="sql-prepare-title"> documentation.
+ linkend="sql-prepare"> documentation.
See Also
- endterm="sql-deallocate-title">
- endterm="sql-prepare-title">
+
+
- id="SQL-EXPLAIN-TITLE">EXPLAIN
+ EXPLAIN
7
SQL - Language Statements
In order to allow the
PostgreSQL query
planner to make reasonably informed decisions when optimizing
- queries, the endterm="sql-analyze-title">
+ queries, the
statement should be run to record statistics about the distribution
of data within the table. If you have not done this (or if the
statistical distribution of the data in the table has changed
See Also
- endterm="sql-analyze-title">
+
- id="SQL-FETCH-TITLE">FETCH
+ FETCH
7
SQL - Language Statements
- endterm="sql-declare-title">
+
is used to define a cursor. Use
- endterm="sql-move-title">
+
to change cursor position without retrieving data.
See Also
- endterm="sql-close-title">
- endterm="sql-declare-title">
- endterm="sql-move-title">
+
+
+
- id="sql-grant-title">GRANT
+ GRANT
7
SQL - Language Statements
creates the object; then there is no window in which another user
can use the object.)
Also, these initial default privilege settings can be changed using the
- endterm="sql-alterdefaultprivileges-title">
+
command.
SELECT
- Allows endterm="sql-select-title"> from
+ Allows from
any column, or the specific columns listed, of the specified table,
view, or sequence.
Also allows the use of
- endterm="sql-copy-title"> TO.
+ TO.
This privilege is also needed to reference existing column values in
- endterm="sql-update-title"> or
- endterm="sql-delete-title">.
+ or
+ .
For sequences, this privilege also allows the use of the
currval function.
For large objects, this privilege allows the object to be read.
INSERT
- Allows endterm="sql-insert-title"> of a new
+ Allows of a new
row into the specified table. If specific columns are listed,
only those columns may be assigned to in the INSERT>
command (other columns will therefore receive default values).
- Also allows endterm="sql-copy-title"> FROM.
+ Also allows FROM.
UPDATE
- Allows endterm="sql-update-title"> of any
+ Allows of any
column, or the specific columns listed, of the specified table.
(In practice, any nontrivial UPDATE> command will require
SELECT> privilege as well, since it must reference table
DELETE
- Allows endterm="sql-delete-title"> of a row
+ Allows of a row
from the specified table.
(In practice, any nontrivial DELETE> command will require
SELECT> privilege as well, since it must reference table
TRUNCATE
- Allows endterm="sql-truncate-title"> on
+ Allows on
the specified table.
Allows the creation of a trigger on the specified table. (See the
- endterm="sql-createtrigger-title"> statement.)
+ statement.)
Notes
- The endterm="sql-revoke-title"> command is used
+ The command is used
to revoke access privileges.
See Also
- endterm="sql-revoke-title">
- endterm="sql-alterdefaultprivileges-title">
+
+
- id="APP-INITDB-TITLE">initdb
+ initdb
1
Application
- id="SQL-INSERT-TITLE">INSERT
+ INSERT
7
SQL - Language Statements
A query (SELECT statement) that supplies the
rows to be inserted. Refer to the
- endterm="sql-select-title">
+
statement for a description of the syntax.
Possible limitations of the
class="PARAMETER">query clause are documented under
- endterm="sql-select-title">.
+ .
- id="SQL-LISTEN-TITLE">LISTEN
+ LISTEN
7
SQL - Language Statements
- endterm="sql-notify-title">
+
contains a more extensive
discussion of the use of LISTEN and
NOTIFY.
See Also
- endterm="sql-notify-title">
- endterm="sql-unlisten-title">
+
+
- id="SQL-LOAD-TITLE">LOAD
+ LOAD
7
SQL - Language Statements
The file name is specified in the same way as for shared library
- names in endterm="sql-createfunction-title">; in particular, one
+ names in ; in particular, one
can rely on a search path and automatic addition of the system's standard
shared library file name extension. See for
more information on this topic.
See Also
- endterm="sql-createfunction-title">
+
- id="sql-lock-title">LOCK
+ LOCK
7
SQL - Language Statements
PostgreSQL reports an error if
LOCK>
is used outside a transaction block.
Use
- endterm="sql-begin-title"> and
- endterm="sql-commit-title">
- (or endterm="sql-rollback-title">)
+ and
+
+ (or )
to define a transaction block.
There is no LOCK TABLE in the SQL standard,
which instead uses SET TRANSACTION to specify
concurrency levels on transactions.
PostgreSQL supports that too;
- see
- endterm="SQL-SET-TRANSACTION-TITLE"> for details.
+ see for details.
- id="SQL-MOVE-TITLE">MOVE
+ MOVE
7
SQL - Language Statements
The parameters for the MOVE command are identical to
those of the FETCH command; refer to
- endterm="sql-fetch-title">
+
for details on syntax and usage.
See Also
- endterm="sql-close-title">
- endterm="sql-declare-title">
- endterm="sql-fetch-title">
+
+
+
- id="sql-notify-title">NOTIFY
+ NOTIFY
7
SQL - Language Statements
See Also
- endterm="sql-listen-title">
- endterm="sql-unlisten-title">
+
+
-
+
- id="app-pgconfig-title">pg_config
+ pg_config
1
Application
-
id="APP-PGCONTROLDATA-TITLE">pg_controldata
1
Application
-
id="app-pg-ctl-title">pg_ctl
1
Application
-
id="APP-PG-DUMPALL-TITLE">pg_dumpall
1
Application
-
id="APP-PGRESETXLOG-TITLE">pg_resetxlog
1
Application
-
id="APP-POSTMASTER-TITLE">postmaster
1
Application
- id="sql-prepare-title">PREPARE
+ PREPARE
7
SQL - Language Statements
in which the parameter is used (if possible). When executing the
statement, specify the actual values for these parameters in the
EXECUTE statement. Refer to
- linkend="sql-execute" endterm="sql-execute-title"> for more
+ linkend="sql-execute"> for more
information about that.
also means that a single prepared statement cannot be used by
multiple simultaneous database clients; however, each client can create
their own prepared statement to use. The prepared statement can be
- manually cleaned up using the
- endterm="sql-deallocate-title"> command.
+ manually cleaned up using the command.
when planning prepared statements with parameters, the chosen plan
might be suboptimal. To examine the query plan
PostgreSQL has chosen for a prepared
- statement, use
- endterm="sql-explain-title">.
+ statement, use .
For more information on query planning and the statistics collected
by
PostgreSQL for that purpose, see
- the endterm="sql-analyze-title">
+ the
documentation.
See Also
- endterm="sql-deallocate-title">
- endterm="sql-execute-title">
+
+
- id="sql-prepare-transaction-title">PREPARE TRANSACTION
+ PREPARE TRANSACTION
7
SQL - Language Statements
Once prepared, a transaction can later be committed or rolled back
- with endterm="sql-commit-prepared-title">
- or endterm="sql-rollback-prepared-title">,
+ with
+ or ,
respectively. Those commands can be issued from any session, not
only the one that executed the original transaction.
This command must be used inside a transaction block. Use
- linkend="sql-begin" endterm="sql-begin-title"> to start one.
+ linkend="sql-begin"> to start one.
See Also
- endterm="sql-commit-prepared-title">
- endterm="sql-rollback-prepared-title">
+
+
-
id="app-psql-title">psql
1
Application
Whenever a command is executed,
psql also polls
for asynchronous notification events generated by
- endterm="SQL-LISTEN-title"> and
- endterm="SQL-NOTIFY-title">.
+ and
+ .
Performs a frontend (client) copy. This is an operation that
- runs an
SQL
- endterm="SQL-COPY-title"> command, but instead of the server
+ command, but instead of the server
reading or writing the specified file,
psql reads or writes the file and
routes the data between the server and the local file system.
The syntax of the command is similar to that of the
-
SQL
- endterm="sql-copy-title"> command. Note that, because of this,
+ command. Note that, because of this,
special parsing rules apply to the \copy
command. In particular, the variable substitution rules and
backslash escapes do not apply.
Descriptions for objects can be created with the
- linkend="sql-comment" endterm="sql-comment-title">
+ linkend="sql-comment">
- The
- endterm="sql-alterdefaultprivileges-title"> command is used to set
+ The command is used to set
default access privileges. The meaning of the
privilege display is explained under
- endterm="sql-grant-title">.
+ .
- The endterm="sql-grant-title"> and
- endterm="sql-revoke-title">
+ The and
+
commands are used to set access privileges. The meaning of the
privilege display is explained under
- endterm="sql-grant-title">.
+ .
- The endterm="sql-alterrole-title"> and
- endterm="sql-alterdatabase-title">
+ The and
+
commands are used to define per-role and per-database configuration
settings.
This command is totally separate from the
SQL
- command endterm="SQL-SET-title">.
+ command .
- id="SQL-REASSIGN-OWNED-TITLE">REASSIGN OWNED
+ REASSIGN OWNED
7
SQL - Language Statements
- The
- endterm="sql-drop-owned-title"> command is an alternative that
+ The command is an alternative that
drops all the database objects owned by one or more roles. Note
also that DROP OWNED requires privileges only
on the source role(s).
See Also
- endterm="sql-drop-owned-title">
- endterm="sql-droprole-title">
+
+
- id="SQL-REINDEX-TITLE">REINDEX
+ REINDEX
7
SQL - Language Statements
-
id="APP-REINDEXDB-TITLE">reindexdb
1
Application
reindexdb is a wrapper around the SQL
- command endterm="sql-reindex-title">.
+ command .
There is no effective difference between reindexing databases via
this utility and via other methods for accessing the server.
Diagnostics
- In case of difficulty, see
- endterm="sql-reindex-title"> and for
+ In case of difficulty, see >
+ and for
discussions of potential problems and error messages.
The database server must be running at the
targeted host. Also, any default connection settings and environment
See Also
- endterm="sql-reindex-title">
+
- id="SQL-RELEASE-SAVEPOINT-TITLE">RELEASE SAVEPOINT
+ RELEASE SAVEPOINT
7
SQL - Language Statements
Destroying a savepoint makes it unavailable as a rollback point,
but it has no other user visible behavior. It does not undo the
effects of commands executed after the savepoint was established.
- (To do that, see
- endterm="sql-rollback-to-title">.) Destroying a savepoint when
+ (To do that, see >.)
+ Destroying a savepoint when
it is no longer needed allows the system to reclaim some resources
earlier than transaction end.
See Also
- endterm="sql-begin-title">
- endterm="sql-commit-title">
- endterm="sql-rollback-title">
- endterm="sql-rollback-to-title">
- endterm="sql-savepoint-title">
+
+
+
+
+
- id="SQL-RESET-TITLE">RESET
+ RESET
7
SQL - Language Statements
SET configuration_parameter TO DEFAULT
- Refer to endterm="sql-set-title"> for
+ Refer to for
details.
Name of a settable run-time parameter. Available parameters are
documented in and on the
- endterm="sql-set-title"> reference page.
+ reference page.
See Also
- endterm="SQL-SET-title">
- endterm="SQL-SHOW-title">
+
+
- id="sql-revoke-title">REVOKE
+ REVOKE
7
SQL - Language Statements
- See the description of the endterm="sql-grant-title"> command for
+ See the description of the command for
the meaning of the privilege types.
Use 's \dp command to
display the privileges granted on existing tables and columns. See
- linkend="sql-grant" endterm="sql-grant-title"> for information about the
+ linkend="sql-grant"> for information about the
format. For non-table objects there are other \d> commands
that can display their privileges.
Compatibility
- The compatibility notes of the endterm="sql-grant-title"> command
+ The compatibility notes of the command
apply analogously to REVOKE.
The keyword RESTRICT or CASCADE
is required according to the standard, but
PostgreSQL>
See Also
- endterm="sql-grant-title">
+
- id="SQL-ROLLBACK-TITLE">ROLLBACK
+ ROLLBACK
7
SQL - Language Statements
Notes
- Use endterm="SQL-COMMIT-TITLE"> to
+ Use to
successfully terminate a transaction.
See Also
- endterm="sql-begin-title">
- endterm="sql-commit-title">
- endterm="sql-rollback-to-title">
+
+
+
- id="sql-rollback-prepared-title">ROLLBACK PREPARED
+ ROLLBACK PREPARED
7
SQL - Language Statements
See Also
- endterm="sql-prepare-transaction-title">
- endterm="sql-commit-prepared-title">
+
+
- id="SQL-ROLLBACK-TO-TITLE">ROLLBACK TO SAVEPOINT
+ ROLLBACK TO SAVEPOINT
7
SQL - Language Statements
Use
- endterm="SQL-RELEASE-SAVEPOINT-TITLE"> to destroy a savepoint without
+ > to destroy a savepoint without
discarding the effects of commands executed after it was established.
See Also
- endterm="sql-begin-title">
- endterm="sql-commit-title">
- endterm="sql-release-savepoint-title">
- endterm="sql-rollback-title">
- endterm="sql-savepoint-title">
+
+
+
+
+
- id="SQL-SAVEPOINT-TITLE">SAVEPOINT
+ SAVEPOINT
7
SQL - Language Statements
Notes
- Use endterm="SQL-ROLLBACK-TO-TITLE"> to
- rollback to a savepoint. Use
- endterm="SQL-RELEASE-SAVEPOINT-TITLE"> to destroy a savepoint, keeping
+ Use to
+ rollback to a savepoint. Use >
+ to destroy a savepoint, keeping
the effects of commands executed after it was established.
See Also
- endterm="sql-begin-title">
- endterm="sql-commit-title">
- endterm="sql-release-savepoint-title">
- endterm="sql-rollback-title">
- endterm="sql-rollback-to-title">
+
+
+
+
+
- id="sql-select-title">SELECT
+ SELECT
7
SQL - Language Statements
sub-SELECT must be surrounded by
parentheses, and an alias must be
provided for it. A
- endterm="sql-values-title"> command
+ command
can also be used here.
to the row-level lock(s) — the required ROW SHARE
table-level lock is still taken in the ordinary way (see
). You can use
- endterm="sql-lock-title">
+
with the NOWAIT> option first,
if you need to acquire the table-level lock without waiting.
- id="SQL-SELECTINTO-TITLE">SELECT INTO
+ SELECT INTO
7
SQL - Language Statements
If specified, the table is created as a temporary table. Refer
- to
- endterm="sql-createtable-title"> for details.
+ to for details.
All other parameters are described in detail under
- linkend="sql-select" endterm="sql-select-title">.
+ linkend="sql-select">.
Notes
-
- endterm="sql-createtableas-title"> is functionally similar to
+ is functionally similar to
SELECT INTO. CREATE TABLE AS
is the recommended syntax, since this form of SELECT
INTO is not available in
ECPG
See Also
- endterm="sql-createtableas-title">
+
- id="SQL-SET-TITLE">SET
+ SET
7
SQL - Language Statements
If SET LOCAL is used within a function that has a
SET> option for the same variable (see
- endterm="sql-createfunction-title">),
+ ),
the effects of the SET LOCAL command disappear at
function exit; that is, the value in effect when the function was called is
restored anyway. This allows SET LOCAL to be used for
See Also
- endterm="SQL-RESET-title">
- endterm="SQL-SHOW-title">
+
+
-
+
- id="SQL-SET-CONSTRAINTS-title">SET CONSTRAINTS
+ SET CONSTRAINTS
7
SQL - Language Statements
- id="sql-set-role-title">SET ROLE
+ SET ROLE
7
SQL - Language Statements
The SESSION> and LOCAL> modifiers act the same
- as for the regular endterm="SQL-SET-title">
+ as for the regular
command.
SET ROLE> has effects comparable to
-
- endterm="sql-set-session-authorization-title">, but the privilege
+ , but the privilege
checks involved are quite different. Also,
SET SESSION AUTHORIZATION> determines which roles are
allowable for later SET ROLE> commands, whereas changing
SET ROLE> does not process session variables as specified by
- the role's
- endterm="sql-alterrole-title"> settings; this only happens during
+ the role's settings; this only happens during
login.
See Also
- endterm="sql-set-session-authorization-title">
+
-
+
- id="sql-set-session-authorization-title">SET SESSION AUTHORIZATION
+ SET SESSION AUTHORIZATION
7
SQL - Language Statements
identifier is normally equal to the session user identifier, but
might change temporarily in the context of SECURITY DEFINER>
functions and similar mechanisms; it can also be changed by
- endterm="sql-set-role-title">.
+ .
The current user identifier is relevant for permission checking.
The SESSION> and LOCAL> modifiers act the same
- as for the regular endterm="SQL-SET-title">
+ as for the regular
command.
See Also
- endterm="sql-set-role-title">
+
-
+
- id="SQL-SET-TRANSACTION-TITLE">SET TRANSACTION
+ SET TRANSACTION
7
SQL - Language Statements
- id="SQL-SHOW-TITLE">SHOW
+ SHOW
7
SQL - Language Statements
The name of a run-time parameter. Available parameters are
documented in
and on the
- linkend="SQL-SET" endterm="SQL-SET-title"> reference page. In
+ linkend="SQL-SET"> reference page. In
addition, there are a few parameters that can be shown but not
set:
See Also
- endterm="SQL-SET-title">
- endterm="SQL-RESET-title">
+
+
- id="SQL-START-TRANSACTION-TITLE">START TRANSACTION
+ START TRANSACTION
7
SQL - Language Statements
This command begins a new transaction block. If the isolation level or
read/write mode is specified, the new transaction has those
- characteristics, as if
- endterm="sql-set-transaction-title"> was executed. This is the same
- as the command.
+ characteristics, as if was executed. This is the same
+ as the command.
Parameters
- Refer to
- endterm="sql-set-transaction-title"> for information on the meaning
+ Refer to for information on the meaning
of the parameters to this statement.
- See also the compatibility section of
- endterm="sql-set-transaction-title">.
+ See also the compatibility section of .
See Also
- endterm="sql-begin-title">
- endterm="sql-commit-title">
- endterm="sql-rollback-title">
- endterm="sql-savepoint-title">
- endterm="sql-set-transaction-title">
+
+
+
+
+
- id="SQL-TRUNCATE-TITLE">TRUNCATE
+ TRUNCATE
7
SQL - Language Statements
- id="SQL-UNLISTEN-TITLE">UNLISTEN
+ UNLISTEN
7
SQL - Language Statements
- endterm="sql-notify-title" linkend="sql-notify">
+
contains a more extensive
discussion of the use of LISTEN and
NOTIFY.
See Also
- endterm="sql-listen-title">
- endterm="sql-notify-title">
+
+
- id="SQL-UPDATE-TITLE">UPDATE
+ UPDATE
7
SQL - Language Statements
query on the UPDATE>'s target table.
Note that WHERE CURRENT OF> cannot be
specified together with a Boolean condition. See
- endterm="sql-declare-title">
+
for more information about using cursors with
WHERE CURRENT OF>.
- id="sql-vacuum-title">VACUUM
+ VACUUM
7
SQL - Language Statements
VACUUM ANALYZE performs a VACUUM
and then an ANALYZE for each selected table. This
is a handy combination form for routine maintenance scripts. See
- endterm="sql-analyze-title">
+
for more details about its processing.
See Also
- endterm="app-vacuumdb-title">
- endterm="runtime-config-resource-vacuum-cost-title">
- endterm="autovacuum-title">
+
+
+
-
id="APP-VACUUMDB-TITLE">vacuumdb
1
Application
vacuumdb is a wrapper around the SQL
- command endterm="SQL-VACUUM-title">.
+ command .
There is no effective difference between vacuuming and analyzing
databases via this utility and via other methods for accessing the
server.
Diagnostics
- In case of difficulty, see
- endterm="sql-vacuum-title"> and for
+ In case of difficulty, see >
+ and for
discussions of potential problems and error messages.
The database server must be running at the
targeted host. Also, any default connection settings and environment