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 /src/backend | |
parent | 99e0996284b4c1719f6df990630391f7a91d3495 (diff) | |
download | postgresql-31b15fe8dcd2e026afc0b566f50141ae9a7273b5.tar.gz postgresql-31b15fe8dcd2e026afc0b566f50141ae9a7273b5.zip |
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 'src/backend')
-rw-r--r-- | src/backend/tcop/utility.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/backend/tcop/utility.c b/src/backend/tcop/utility.c index b1a0fe28ca5..1218e7cb9b8 100644 --- a/src/backend/tcop/utility.c +++ b/src/backend/tcop/utility.c @@ -10,7 +10,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/tcop/utility.c,v 1.299 2008/10/10 13:48:05 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/tcop/utility.c,v 1.300 2008/11/04 00:57:19 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -938,6 +938,11 @@ ProcessUtility(Node *parsetree, break; case T_LockStmt: + /* + * Since the lock would just get dropped immediately, LOCK TABLE + * outside a transaction block is presumed to be user error. + */ + RequireTransactionChain(isTopLevel, "LOCK TABLE"); LockTableCommand((LockStmt *) parsetree); break; |