diff options
| author | Tom Lane <tgl@sss.pgh.pa.us> | 2008-11-04 00:57:19 +0000 |
|---|---|---|
| committer | Tom Lane <tgl@sss.pgh.pa.us> | 2008-11-04 00:57:19 +0000 |
| commit | 31b15fe8dcd2e026afc0b566f50141ae9a7273b5 (patch) | |
| tree | 05f5e4baa642148d27478d1c71f919ff90d141d1 /doc/src | |
| parent | 99e0996284b4c1719f6df990630391f7a91d3495 (diff) | |
Disallow LOCK TABLE outside a transaction block (or function), since this case
almost certainly represents user error. Per a gripe from Sebastian Böhm
and subsequent discussion.
Diffstat (limited to 'doc/src')
| -rw-r--r-- | doc/src/sgml/ref/declare.sgml | 7 | ||||
| -rw-r--r-- | doc/src/sgml/ref/lock.sgml | 17 |
2 files changed, 13 insertions, 11 deletions
diff --git a/doc/src/sgml/ref/declare.sgml b/doc/src/sgml/ref/declare.sgml index 269d2c101c4..744cda77726 100644 --- a/doc/src/sgml/ref/declare.sgml +++ b/doc/src/sgml/ref/declare.sgml @@ -1,5 +1,5 @@ <!-- -$PostgreSQL: pgsql/doc/src/sgml/ref/declare.sgml,v 1.42 2007/10/24 23:27:07 tgl Exp $ +$PostgreSQL: pgsql/doc/src/sgml/ref/declare.sgml,v 1.43 2008/11/04 00:57:19 tgl Exp $ PostgreSQL documentation --> @@ -175,10 +175,9 @@ DECLARE <replaceable class="parameter">name</replaceable> [ BINARY ] [ INSENSITI <productname>PostgreSQL</productname> reports an error if such a command is used outside a transaction block. Use - <xref linkend="sql-begin" endterm="sql-begin-title">, + <xref linkend="sql-begin" endterm="sql-begin-title"> and <xref linkend="sql-commit" endterm="sql-commit-title"> - and - <xref linkend="sql-rollback" endterm="sql-rollback-title"> + (or <xref linkend="sql-rollback" endterm="sql-rollback-title">) to define a transaction block. </para> diff --git a/doc/src/sgml/ref/lock.sgml b/doc/src/sgml/ref/lock.sgml index d32e6d364c8..701c2a19a48 100644 --- a/doc/src/sgml/ref/lock.sgml +++ b/doc/src/sgml/ref/lock.sgml @@ -1,5 +1,5 @@ <!-- -$PostgreSQL: pgsql/doc/src/sgml/ref/lock.sgml,v 1.49 2008/09/08 00:47:40 tgl Exp $ +$PostgreSQL: pgsql/doc/src/sgml/ref/lock.sgml,v 1.50 2008/11/04 00:57:19 tgl Exp $ PostgreSQL documentation --> @@ -160,12 +160,15 @@ where <replaceable class="PARAMETER">lockmode</replaceable> is one of: </para> <para> - <command>LOCK TABLE</command> is useful only inside a transaction - block (<command>BEGIN</>/<command>COMMIT</> pair), since the lock - is dropped as soon as the transaction ends. A <command>LOCK - TABLE</> command appearing outside any transaction block forms a - self-contained transaction, so the lock will be dropped as soon as - it is obtained. + <command>LOCK TABLE</> is useless outside a transaction block: the lock + would remain held only to the completion of the statement. Therefore + <productname>PostgreSQL</productname> reports an error if <command>LOCK</> + is used outside a transaction block. + Use + <xref linkend="sql-begin" endterm="sql-begin-title"> and + <xref linkend="sql-commit" endterm="sql-commit-title"> + (or <xref linkend="sql-rollback" endterm="sql-rollback-title">) + to define a transaction block. </para> <para> |
