SQL Commands / Transactions
BEGIN WORK
Read the PG 6.4 manualBegins a transaction
Reading PG 6.4·documented in 1 of 30 versions, 6.4 to 6.4
Historical documentation for a PostgreSQL version that is no longer supported.
Syntax
BEGIN [ WORK | TRANSACTION ]
Syntax diagrams
Read left to right. Branches are choices, bypasses are optional, loops repeat. Select an underlined parameter to open its rule.
Description
BEGIN initiates a user transaction which Postgres will guarantee is serializable with respect to all concurrently executing transactions. Postgres uses two-phase locking to perform this task. If the transaction is committed, Postgres will ensure either that all updates are done or else that none of them are done. Transactions have the standard ACID (atomic, consistent, isolatable, and durable) property.
Notes
The keyword TRANSACTION is just a cosmetic alternative to WORK. Neither keyword need be specified.
Refer to the LOCK statement for further information about locking tables inside a transaction.
Use COMMIT or ROLLBACK to terminate a transaction.
Usage
To begin a user transaction:
BEGIN WORK;
Compatibility
BEGIN is a Postgres language extension.
SQL92
There is no explicit BEGIN WORK command in SQL92; transaction initiation is always implicit and it terminates either with a COMMIT or with a ROLLBACK statement.
Version history 1
- 6.4 → 6.5 removed
Definition snapshot: b7bd9cda · English manual source