From b65cd562402ed9d3206d501cc74dc38bc421b2ce Mon Sep 17 00:00:00 2001 From: Peter Eisentraut Date: Fri, 10 Jan 2003 22:03:30 +0000 Subject: Read-only transactions, as defined in SQL. --- doc/src/sgml/features.sgml | 28 ++++++------- doc/src/sgml/ref/set_transaction.sgml | 70 ++++++++++++++++++++++----------- doc/src/sgml/ref/start_transaction.sgml | 53 ++++++------------------- doc/src/sgml/release.sgml | 3 +- 4 files changed, 75 insertions(+), 79 deletions(-) (limited to 'doc/src') diff --git a/doc/src/sgml/features.sgml b/doc/src/sgml/features.sgml index fd01cd3cce6..9c7cc471935 100644 --- a/doc/src/sgml/features.sgml +++ b/doc/src/sgml/features.sgml @@ -1,5 +1,5 @@ @@ -642,6 +642,12 @@ $Header: /cvsroot/pgsql/doc/src/sgml/features.sgml,v 2.13 2003/01/10 11:02:41 pe ROLLBACK statement + + E152 + Core + Basic SET TRANSACTION statement + + E152-01 Core @@ -649,6 +655,13 @@ $Header: /cvsroot/pgsql/doc/src/sgml/features.sgml,v 2.13 2003/01/10 11:02:41 pe clause + + E152-02 + Core + SET TRANSACTION statement: READ ONLY and READ WRITE + clauses + + E161 Core @@ -1598,19 +1611,6 @@ $Header: /cvsroot/pgsql/doc/src/sgml/features.sgml,v 2.13 2003/01/10 11:02:41 pe WITH HOLD cursors Cursor to stay open across transactions - - E152 - Core - Basic SET TRANSACTION statement - - - - E152-02 - Core - SET TRANSACTION statement: READ ONLY and READ WRITE - clauses - Syntax accepted; READ ONLY not supported - E153 Core diff --git a/doc/src/sgml/ref/set_transaction.sgml b/doc/src/sgml/ref/set_transaction.sgml index 315a999330f..f39e0eb7fe6 100644 --- a/doc/src/sgml/ref/set_transaction.sgml +++ b/doc/src/sgml/ref/set_transaction.sgml @@ -1,4 +1,4 @@ - + 2000-11-24 @@ -16,9 +16,10 @@ -SET TRANSACTION ISOLATION LEVEL { READ COMMITTED | SERIALIZABLE } -SET SESSION CHARACTERISTICS AS TRANSACTION ISOLATION LEVEL - { READ COMMITTED | SERIALIZABLE } +SET TRANSACTION + [ ISOLATION LEVEL { READ COMMITTED | SERIALIZABLE } ] [ READ WRITE | READ ONLY ] +SET SESSION CHARACTERISTICS AS TRANSACTION + [ ISOLATION LEVEL { READ COMMITTED | SERIALIZABLE } ] [ READ WRITE | READ ONLY ] @@ -26,17 +27,19 @@ SET SESSION CHARACTERISTICS AS TRANSACTION ISOLATION LEVEL Description - This command sets the transaction isolation level. The - SET TRANSACTION command sets the characteristics - for the current SQL-transaction. It has no effect on any subsequent - transactions. This command cannot be used after the first query or data-modification - statement (SELECT, INSERT, - DELETE, UPDATE, - FETCH, COPY) of a transaction - has been executed. SET SESSION CHARACTERISTICS - sets the default transaction isolation level for each transaction - for a session. SET TRANSACTION can override it - for an individual transaction. + The SET TRANSACTION command sets the transaction + characteristics of the current SQL-transaction. It has no effect on + any subsequent transactions. SET SESSION + CHARACTERISTICS sets the default transaction + characteristics for each transaction of a session. SET + TRANSACTION can override it for an individual + transaction. + + + + The available transaction characteristics are the transaction + isolation level and the transaction access mode (read/write or + read-only). @@ -45,7 +48,7 @@ SET SESSION CHARACTERISTICS AS TRANSACTION ISOLATION LEVEL - READ COMMITTED + READ COMMITTED A statement can only see rows committed before it began. This @@ -55,7 +58,7 @@ SET SESSION CHARACTERISTICS AS TRANSACTION ISOLATION LEVEL - SERIALIZABLE + SERIALIZABLE The current transaction can only see rows committed before @@ -72,6 +75,28 @@ SET SESSION CHARACTERISTICS AS TRANSACTION ISOLATION LEVEL + + The transaction isolation level cannot be set after the first query + or data-modification statement (SELECT, + INSERT, DELETE, + UPDATE, FETCH, + COPY) of a transaction has been executed. + + + + The transaction access mode determines whether the transaction is + read/write or read-only. Read/write is the default. When a + transaction is read-only, the following SQL commands are + disallowed: INSERT, UPDATE, + DELETE, and COPY TO if the + table they would write to is not a temporary table; all + CREATE, ALTER, and + DROP commands; COMMENT, + GRANT, REVOKE, + TRUNCATE; and EXPLAIN ANALYZE + and EXECUTE if the command they would execute is + among those listed. This is a high-level notion of read-only that + does not prevent writes to disk. @@ -97,7 +122,7 @@ SET default_transaction_isolation = 'value' SQL92, SQL99 - is the default level in + is the default transaction isolation level in SQL. PostgreSQL does not provide the isolation levels and . Because of multiversion @@ -107,11 +132,10 @@ SET default_transaction_isolation = 'value' - In SQL there are two other transaction - characteristics that can be set with these commands: whether the - transaction is read-only and the size of the diagnostics area. - Neither of these concepts are supported in - PostgreSQL. + In SQL there is one other transaction + characteristic that can be set with these commands: the size of + the diagnostics area. This concept is not supported in + PostgreSQL. diff --git a/doc/src/sgml/ref/start_transaction.sgml b/doc/src/sgml/ref/start_transaction.sgml index fb8dd131932..087a0df1774 100644 --- a/doc/src/sgml/ref/start_transaction.sgml +++ b/doc/src/sgml/ref/start_transaction.sgml @@ -1,5 +1,5 @@ @@ -20,7 +20,7 @@ PostgreSQL documentation -START TRANSACTION [ ISOLATION LEVEL { READ COMMITTED | SERIALIZABLE } ] +START TRANSACTION [ ISOLATION LEVEL { READ COMMITTED | SERIALIZABLE } ] [ READ WRITE | READ ONLY ] @@ -77,52 +77,23 @@ WARNING: BEGIN: already a transaction in progress Description - This command begins a new transaction. If the isolation level is - specified, the new transaction has that isolation level. In all other - respects, the behavior of this command is identical to the - command. + This command begins a new transaction. If the isolation level or + read/write mode is specified, the new transaction has those + characteristics, as if was executed. In all other + respects, the behavior of this command is identical to the command. - - Notes - - - The isolation level of a transaction can also be set with the - command. If no isolation level is specified, the default isolation - level is used. - - - Compatibility - - SQL99 - - - is the default isolation level in - SQL99, but it is not the usual default in - PostgreSQL: the factory default setting - is READ COMMITTED. - PostgreSQL - does not provide the isolation levels - and . Because of lack of predicate - locking, the level is - not truly serializable. See the User's Guide - for details. - - - - In SQL99 this statement can specify two other - properties of the new transaction: whether the transaction is - read-only and the size of the diagnostics area. Neither of these - concepts are currently supported in - PostgreSQL. - - + + SQL99; but see also the compatibility section of . + diff --git a/doc/src/sgml/release.sgml b/doc/src/sgml/release.sgml index 55007a7d627..fd9a5e698f5 100644 --- a/doc/src/sgml/release.sgml +++ b/doc/src/sgml/release.sgml @@ -1,5 +1,5 @@ @@ -36,6 +36,7 @@ System can use either hash- or sort-based strategy for grouped aggregation ON COMMIT options for temp tables extra_float_digits option allows pg_dump to dump float data accurately Long options for psql and pg_dump are now available on all platforms +Read-only transactions ]]> -- cgit v1.2.3