ABORT rolls back the current transaction and causes
all the updates made by the transaction to be discarded.
This command is identical
- in behavior to the standard
SQL command
ROLLBACK,
+ in behavior to the standard
SQL command
+ ,
and is present only for historical reasons.
-
-
Diagnostics
-
-
-
- ROLLBACK
-
- Message returned if successful.
-
-
-
-
-
- WARNING: ROLLBACK: no transaction in progress
-
- If there is not any transaction currently in progress.
-
-
-
-
-
-
Notes
- Use COMMIT to successfully
- terminate a transaction.
+ Use to
+ successfully terminate a transaction.
+
+
+ Issuing ABORT> when not inside a transaction does
+ no harm, but it will provoke a warning message.
+
+
See Also
+
+
+
+
+
+
+
ALTER AGGREGATE changes the definition of an
- aggregate function. The only functionality is to rename the
- aggregate function.
+ aggregate function. The only currently available functionality is to
+ rename the aggregate function.
-
-
-
Diagnostics
-
-
-
- ALTER AGGREGATE
-
- Message returned if the command was successful.
-
-
-
-
-
Examples
ALTER CONVERSION changes the definition of a
- conversion. The only functionality is to rename the conversion.
+ conversion. The only currently available functionality is to rename the
+ conversion.
-
-
-
Diagnostics
-
-
-
- ALTER CONVERSION
-
- Message returned if the command was successful.
-
-
-
-
-
Examples
-
-
Diagnostics
-
-
-
- ALTER DATABASE
-
- Message returned if the alteration was successful.
-
-
-
-
-
- ERROR: database "dbname" does not exist
-
- Error message returned if the specified database is not known
- to the system.
-
-
-
-
-
-
Notes
-
- 2002-11-27
-
ALTER DOMAIN domain
{ SET DEFAULT value | DROP DEFAULT }
ALTER DOMAIN domain
OWNER TO new_owner
-
-
-
- 2002-11-27
-
-
- Inputs
-
-
-
-
- domain
-
- The name (possibly schema-qualified) of an existing domain to
- alter.
-
-
-
-
-
- domain_constraint
-
- New domain constraint for the domain.
-
-
-
-
-
- constraint_name
-
- Name of an existing constraint to drop.
-
-
-
-
-
- CASCADE
-
- Automatically drop objects that depend on the constraint.
-
-
-
-
-
- RESTRICT
-
- Refuse to drop the constraint if there are any dependent
- objects. This is the default behavior.
-
-
-
-
-
- new_owner
-
- The user name of the new owner of the domain.
-
-
-
-
-
-
-
-
-
-
- 1998-04-15
-
-
- Outputs
-
-
-
-
- ALTER DOMAIN
-
- Message returned from domain alteration.
-
-
-
-
-
- ERROR
-
- Message returned if domain is not available.
-
-
-
-
-
-
-
-
- 2002-11-27
-
-
- Description
-
+
+
Description
+
ALTER DOMAIN changes the definition of an existing domain.
There are several sub-forms:
-
-
- Usage
-
+
+
Parameters
+
+
+
+ domain
+
+ The name (possibly schema-qualified) of an existing domain to
+ alter.
+
+
+
+
+
+ domain_constraint
+
+ New domain constraint for the domain.
+
+
+
+
+
+ constraint_name
+
+ Name of an existing constraint to drop.
+
+
+
+
+
+ CASCADE
+
+ Automatically drop objects that depend on the constraint.
+
+
+
+
+
+ RESTRICT
+
+ Refuse to drop the constraint if there are any dependent
+ objects. This is the default behavior.
+
+
+
+
+
+ new_owner
+
+ The user name of the new owner of the domain.
+
+
+
+
+
+
+
+
+
+
Examples
+
To add a NOT NULL constraint to a domain:
+
+
Compatibility
+
+ The ALTER DOMAIN statement is compatible with SQL99,
+ except for the OWNER> variant, which is a
+
+
-
-
-
Diagnostics
-
-
-
- ALTER FUNCTION
-
- Message returned if the command was successful.
-
-
-
-
-
Examples
-
-
Diagnostics
-
-
-
- ALTER GROUP
-
- Message returned if the alteration was successful.
-
-
-
-
-
-
Examples
-
-
Diagnostics
-
-
-
- ALTER LANGUAGE
-
- Message returned if the alteration was successful.
-
-
-
-
-
-
Compatibility
-
-
-
Diagnostics
-
-
-
- ALTER OPERATOR CLASS
-
- Message returned if the command was successful.
-
-
-
-
-
Compatibility
-
-
Diagnostics
-
-
-
- ALTER SCHEMA
-
- Message returned if the alteration was successful.
-
-
-
-
-
-
Compatibility
-
- 1999-07-20
-
ALTER SEQUENCE seqname [ INCREMENT [ BY ] increment ]
[ MINVALUE minvalue | NO MINVALUE ] [ MAXVALUE maxvalue | NO MAXVALUE ]
[ RESTART [ WITH ] start ] [ CACHE cache ] [ [ NO ] CYCLE ]
-
-
-
- 1998-09-11
-
-
- Inputs
-
+
+
+
Description
+
+ ALTER SEQUENCE changes the parameters of an existing
+ sequence generator. Any parameter not specifically set in the
+ ALTER SEQUENCE command retains its prior setting.
+
+
+
+
+
Parameters
+
seqname
The optional
- start
- clause enables the sequence to re-begin anywhere.
+ start
+ clause changes the current value of the sequence.
-
-
-
-
- 1998-09-11
-
-
- Outputs
-
-
-
-
-
-ALTER SEQUENCE
-
-
- Message returned if the command is successful.
-
-
-
-
-
-ERROR: AlterSequence: MINVALUE (start) can't be >= MAXVALUE (max)
-
-
- If the specified starting value is out of range.
-
-
-
-
-
-ERROR: AlterSequence: START value (start) can't be < MINVALUE (min)
-
-
- If the specified starting value is out of range.
-
-
-
-
-
-ERROR: AlterSequence: MINVALUE (min) can't be >= MAXVALUE (max)
-
-
- If the minimum and maximum values are inconsistent.
-
-
-
-
-
-
-
+
-
-
- Description
-
-
- See for limitations, and uses
- of sequences.
-
-
+
+
Examples
-
-
- Usage
-
Restart a sequence called serial, at 105:
-
-
- Notes
-
+
+
Notes
+
- To avoid blocking of concurrent transactions that obtain numbers from the same
- sequence, a nextval operation is never rolled back; that is, once a value has
- been fetched it is considered used, even if the transaction that did the nextval
- later aborts. This means that aborted transactions may leave unused "holes" in
- the sequence of assigned values. setval operations are never rolled back, either.
+ To avoid blocking of concurrent transactions that obtain numbers from the
+ same sequence, ALTER SEQUENCE is never rolled back;
+ the changes take effect immediately and are not reversible.
+
- ALTER SEQUENCE will not immediately affect backends, other than the
- current one, which have cached sequence values. They must use up all cached values
- prior to noticing the changed sequence parameters. The current backend will be
- immediatly affected.
+ ALTER SEQUENCE will not immediately affect
+ nextval> results in backends,
+ other than the current one, that have preallocated (cached) sequence
+ values. They will use up all cached values prior to noticing the changed
+ sequence parameters. The current backend will be affected immediately.
- id="R1-SQL-ALTERSEQUENCE-3">
+
Compatibility
-
-
- 2003-03-02
-
+
SQL99
-
-
Diagnostics
-
-
-
- ALTER TABLE
-
- Message returned if successful.
-
-
-
-
-
- ERROR
-
- Message returned if table or column does not exist.
-
-
-
-
-
-
Notes
-
Parameter
+
Parameters
-
-
Diagnostics
-
-
-
- ALTER TRIGGER
-
- Message returned if successful.
-
-
-
-
-
- ERROR
-
- If the trigger does not exist, or the new name is a duplicate of
- another existing trigger on the table.
-
-
-
-
-
-
Examples
-
-
Diagnostics
-
-
-
- ALTER USER
-
- Message returned if the alteration was successful.
-
-
-
-
-
- ERROR: ALTER USER: user "username" does not exist
-
- Error message returned if the specified user is not known to
- the database system.
-
-
-
-
-
-
Notes
-
-
Diagnostics
-
-
-
- ANALYZE
-
- The command is complete.
-
-
-
-
-
-
Notes
Description
- By default,
PostgreSQL executes
- transactions in autocommit
mode, that is, each
- statement is executed in its own transaction and a commit is
- implicitly performed at the end of the statement (if execution was
- successful, otherwise a rollback is done).
BEGIN initiates a transaction block, that is,
all statements after BEGIN command will be
executed in a single transaction until an explicit
linkend="sql-commit" endterm="sql-commit-title"> or
- linkend="sql-rollback" endterm="sql-rollback-title">. Statements
- are executed more quickly in a transaction block, because
+ linkend="sql-rollback" endterm="sql-rollback-title"> is given.
+ By default (without BEGIN),
+ transactions in autocommit
mode, that is, each
+ statement is executed in its own transaction and a commit is
+ implicitly performed at the end of the statement (if execution was
+ successful, otherwise a rollback is done).
+
+
+ Statements are executed more quickly in a transaction block, because
transaction start/commit requires significant CPU and disk
activity. Execution of multiple statements inside a transaction is
- also useful to ensure consistency when changing several related
- tables: other sessions will be unable to see the intermediate states
+ also useful to ensure consistency when making several related changes:
+ other sessions will be unable to see the intermediate states
wherein not all the related updates have been done.
-
-
Diagnostics
-
-
-
- BEGIN
-
- This signifies that a new transaction has been started.
-
-
-
-
-
- WARNING: BEGIN: already a transaction in progress
-
- This indicates that a transaction was already in progress. The
- current transaction is not affected.
-
-
-
-
-
-
Notes
Use or
- to terminate a transaction.
+ to terminate a transaction block.
+
+
+ Issuing BEGIN> when already inside a transaction block will
+ provoke a warning message. The state of the transaction is not affected.
about the transaction semantics when porting database applications.
+
+
+
See Also
+
+
+
+
+
+
Every non-holdable open cursor is implicitly closed when a
transaction is terminated by COMMIT or
- ROLLBACK. Holdable cursors are implicitely
- closed if the transaction that created them aborts via
- ROLLBACK; if this does not happen, the holdable
+ ROLLBACK. A holdable cursor is implicitly
+ closed if the transaction that created it aborts via
+ ROLLBACK. If the creating transaction successfully
+ commits, the holdable
cursor remains open until an explicit CLOSE is
executed, or the client disconnects.
-
-
-
Diagnostics
-
-
-
- CLOSE CURSOR
-
- Message returned if the cursor is successfully closed.
-
-
-
-
-
- ERROR: cursor "cursor" does not exist
-
- Message returned if
- class="PARAMETER">cursor is not declared or has
- already been closed.
-
-
-
-
-
Notes
-
-
Diagnostics
-
-
-
- CLUSTER
-
- The clustering was done successfully.
-
-
-
-
-
-
Notes
library will apply.
+ In case of difficulty, see
+ endterm="sql-cluster-title"> and for
+ discussions of potential problems and error messages.
+
+
-
-
Diagnostics
-
-
-
- CLUSTER
-
- The database was successfully clustered.
-
-
-
-
-
- clusterdb: Cluster failed.
-
- Something went wrong.
clusterdb is only a wrapper
- script. See
- and for a detailed
- discussion of error messages and potential problems.
-
-
-
-
-
-
-
-
-
Environment
-
-
Diagnostics
-
-
-
- COMMENT
-
- Message returned if the comment was successfully changed.
-
-
-
-
-
-
Notes
-
-
-
Diagnostics
-
-
-
- COMMIT
-
- Message returned if the transaction was successfully committed.
-
-
-
-
-
- WARNING: COMMIT: no transaction in progress
-
- Message if there is no transaction in progress.
-
-
-
-
-
Notes
Use to
abort a transaction.
+
+ Issuing COMMIT> when not inside a transaction does
+ no harm, but it will provoke a warning message.
+
WORK. Otherwise, this command is fully conforming.
+
+
+
See Also
+
+
+
+
+
+
-
-
-
Diagnostics
-
-
-
- COPY
-
- The copy operation completed successfully.
-
-
-
-
-
Notes
written in any order, not just the order illustrated above.
-
-
-
Diagnostics
-
-
-
- CREATE AGGREGATE
-
- Message returned if the command completes successfully.
-
-
-
-
-
Examples
-
+
-
-
Diagnostics
-
-
-
- CREATE CAST
-
- Message returned if the cast was successfully created.
-
-
-
-
-
-
Notes
-
-
-
Diagnostics
-
-
-
- CREATE TRIGGER
-
- Message returned if successful.
-
-
-
-
-
+
-
-
Diagnostics
-
-
-
- CREATE CONVERSION
-
- Message returned if the conversion was successfully created.
-
-
-
-
-
-
Notes
-
-
Diagnostics
-
-
-
- CREATE DOMAIN
-
- Message returned if the domain was successfully created.
-
-
-
-
-
-
Examples
-
-
Diagnostics
-
-
-
- CREATE FUNCTION
-
- Message returned if the function was successfully created.
-
-
-
-
-
-
Notes
-
-
-
Diagnostics
-
-
-
- CREATE GROUP
-
- Message returned if the group was successfully created.
-
-
-
-
-
Examples
-
-
Diagnostics
-
-
-
- CREATE INDEX
-
- Message returned if the index was successfully created.
-
-
-
-
-
-
Notes
-
-
Diagnostics
-
-
-
- CREATE LANGUAGE
-
- Message returned if the language was successfully created.
-
-
-
-
-
-
Notes
clauses may appear in any order.
-
-
-
Diagnostics
-
-
-
- CREATE OPERATOR CLASS
-
- Message returned if the operator class was successfully created.
-
-
-
-
-
Examples
-
-
-
Diagnostics
-
-
-
- CREATE OPERATOR
-
- Message returned if the operator was successfully created.
-
-
-
-
-
Notes
-
-
Diagnostics
-
-
-
- CREATE RULE
-
- Message returned if the rule was successfully created.
-
-
-
-
-
-
Notes
-
-
Diagnostics
-
-
-
- CREATE SCHEMA
-
- Message returned if the schema was successfully created.
-
-
-
-
-
- ERROR: namespace "schemaname" already exists
-
- Message returned if the schema specified already exists.
-
-
-
-
-
-
Notes
-
-
-
Diagnostics
-
-
-
- CREATE TABLE
-
- Message returned if the table was successfully created.
-
-
-
-
-
-
-
Notes
-
-
Diagnostics
-
- Refer to
- endterm="sql-createtable-title">,
- endterm="sql-select-title">, and
- endterm="sql-execute-title"> for a summary of possible output
- messages.
-
-
-
Notes
-
-
Diagnostics
-
-
-
- CREATE TRIGGER
-
- Message returned if the trigger was successfully created.
-
-
-
-
-
-
Notes
-
-
Diagnostics
-
-
-
- CREATE TYPE
-
- Message returned if the type was successfully created.
-
-
-
-
-
-
Notes
-
-
Diagnostics
-
-
-
- CREATE USER
-
- Message returned if the user account was successfully created.
-
-
-
-
-
-
Notes
-
-
Diagnostics
-
-
-
- DEALLOCATE
-
- Message returned if the prepared statement was deallocated successfully.
-
-
-
-
-
-
Compatibility
-
-
Diagnostics
-
-
-
- DROP AGGREGATE
-
- Message returned if the command was successful.
-
-
-
-
-
- ERROR: RemoveAggregate: aggregate 'name' for type type does not exist
-
- This message is returned if the specified aggregate function
- does not exist.
-
-
-
-
-
-
Examples
-
-
Diagnostics
-
-
-
- DROP DOMAIN
-
- Message returned if the command was successful.
-
-
-
-
-
- ERROR: RemoveDomain: type 'domainname' does not exist
-
- This message occurs if the specified domain does not exist.
-
-
-
-
-
-
Examples
-
-
Diagnostics
-
-
-
- DROP FUNCTION
-
- Message returned if the command completes successfully.
-
-
-
-
-
- WARNING: RemoveFunction: Function name (types) does not exist
-
- This message is output if the function specified does not exist.
-
-
-
-
-
-
Examples
-
-
-
Diagnostics
-
-
-
- DROP GROUP
-
- Message returned if the group was successfully removed.
-
-
-
-
-
Examples
-
-
Diagnostics
-
-
-
- DROP INDEX
-
- Message returned if the command completes successfully.
-
-
-
-
-
- ERROR: index "name" does not exist
-
- This message is returned if
- class="PARAMETER">name is not an existing
- index.
-
-
-
-
-
-
Examples
-
-
-
Diagnostics
-
-
-
- DROP LANGUAGE
-
- This message is returned if the language was successfully dropped.
-
-
-
-
-
- ERROR: Language "name" doesn't exist
-
- This message is returned if a language called
- class="parameter">name is not found in the
- database.
-
-
-
-
-
Examples
-
-
Diagnostics
-
-
-
- DROP OPERATOR CLASS
-
- Message returned if the command was successful.
-
-
-
-
-
-
Examples
-
-
Diagnostics
-
-
-
- DROP OPERATOR
-
- Message returned if the command was successful.
-
-
-
-
-
- ERROR: RemoveOperator: binary operator 'name' taking 'lefttype' and 'righttype' does not exist
-
- This message is returned if the specified binary operator does not exist.
-
-
-
-
-
- ERROR: RemoveOperator: left unary operator 'name' taking 'lefttype' does not exist
-
- This message is returned if the specified left unary operator
- does not exist.
-
-
-
-
-
- ERROR: RemoveOperator: right unary operator 'name' taking 'righttype' does not exist
-
- This message is returned if the specified right unary operator
- does not exist.
-
-
-
-
-
-
Examples
-
-
Diagnostics
-
-
-
- DROP RULE
-
- Message returned if the command was successful.
-
-
-
-
-
- ERROR: Rule "name" not found
-
- Message if the specified rule does not exist.
-
-
-
-
-
-
Examples
-
-
Diagnostics
-
-
-
- DROP SCHEMA
-
- Message returned if the schema was successfully dropped.
-
-
-
-
-
- ERROR: Schema "name" does not exist
-
- This message is returned if the specified schema does not exist.
-
-
-
-
-
-
Examples
-
-
Diagnostics
-
-
-
- DROP SEQUENCE
-
- Message returned if the sequence was successfully dropped.
-
-
-
-
-
- ERROR: sequence "name" does not exist
-
- Message returned if the specified sequence does not exist.
-
-
-
-
-
-
Examples
-
-
Diagnostics
-
-
-
- DROP TABLE
-
- Message returned if the command completes successfully.
-
-
-
-
-
- ERROR: table "name" does not exist
-
- Message returned if the specified table does not exist.
-
-
-
-
-
-
Examples
-
-
Diagnostics
-
-
-
- DROP TRIGGER
-
- Message returned if the trigger was successfully dropped.
-
-
-
-
-
- ERROR: DropTrigger: there is no trigger name on relation "table"
-
- Message returned if the specified trigger does not exist.
-
-
-
-
-
-
Examples
-
-
-
Diagnostics
-
-
-
- DROP TYPE
-
- Message returned if the command was successful.
-
-
-
-
-
- ERROR: RemoveType: type 'typename' does not exist
-
- Message returned if the specified type does not exist.
-
-
-
-
-
Examples
-
-
Diagnostics
-
-
-
- DROP VIEW
-
- Message returned if the command was successful.
-
-
-
-
-
- ERROR: view name does not exist
-
- Message returned if the specified view does not exist.
-
-
-
-
-
-
Examples
-
-
Diagnostics
-
- EXPLAIN prints the execution plan of the
- specified statement from the
PostgreSQL
- planner.
-
-
-
Notes
-
-
Diagnostics
-
-
-
- ERROR: cursor "cursor" does not exist
-
- There is no cursor with the specified name.
-
-
-
-
-
-
Notes
-
-
Diagnostics
-
-
-
- LOCK TABLE
-
- Message returned if the lock was successfully acquired.
-
-
-
-
-
-
Notes
-
-
Diagnostics
-
-
-
- NOTIFY
-
- Message returned when the commmand has executed.
-
-
-
-
-
-
Examples
-
-
Diagnostics
-
-
-
- PREPARE
-
- Message returned if the statement has been prepared successfully.
-
-
-
-
-
-
Notes
-
-
-
Diagnostics
-
-
-
- REINDEX
-
- Message returned if the indexes were successfully recreated.
-
-
-
-
-
Examples
-
-
Diagnostics
-
- See under the .
-
-
-
Examples
-
-
Diagnostics
-
-
-
- ROLLBACK
-
- Message returned if successful.
-
-
-
-
-
- WARNING: ROLLBACK: no transaction in progress
-
- If there is not any transaction currently in progress.
-
-
-
-
-
-
Notes
Use to
successfully terminate a transaction.
+
+ Issuing ROLLBACK> when not inside a transaction does
+ no harm, but it will provoke a warning message.
+
WORK. Otherwise, this command is fully conforming.
+
+
+
See Also
+
+
+
+
+
+
-
-
Diagnostics
-
- Refer to
-
- and
-
- for a summary of possible output messages.
-
-
-
Notes
-
+
SET TRANSACTION
Compatibility
- Both commands are defined in the SQL standard.
+ Both commands are defined in the
SQL standard.
SERIALIZABLE is the default transaction
- isolation level in
SQL; in PostgreSQL it is
- READ COMMITED, but you can change it as
+ isolation level in the standard; in PostgreSQL the default is
+ ordinarily READ COMMITTED, but you can change it as
described above.
PostgreSQL does not
provide the isolation levels READ UNCOMMITTED
and REPEATABLE READ. Because of multiversion
-
-
Diagnostics
-
-
-
- ERROR: Option 'name' is not recognized
-
- Message returned if name does not
- stand for a known parameter.
-
-
-
-
-
-
Notes
-
-
Diagnostics
-
-
-
- START TRANSACTION
-
- Message returned if successful.
-
-
-
-
-
- WARNING: BEGIN: already a transaction in progress
-
- Message returned if there was already a transaction in progress
- when the command was issued.
-
-
-
-
-
-
Compatibility
endterm="sql-set-transaction-title">.
+
+
+
See Also
+
+
+
+
+
+
+
+
-
-
-
Diagnostics
-
-
-
- TRUNCATE TABLE
-
- Message returned if the table was successfully truncated.
-
-
-
-
-
Examples
-
-
Diagnostics
-
-
-
- UNLISTEN
-
- Message returned when the command has executed.
-
-
-
-
-
-
Notes
- You unlisten something you were not listening for; no warning or error will appear.
+ You may unlisten something you were not listening for; no warning or error
+ will appear.
- At the end of each session, UNLISTEN * ist
+ At the end of each session, UNLISTEN * is
automatically executed.