1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-26 01:22:12 +03:00

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.
This commit is contained in:
Tom Lane
2008-11-04 00:57:19 +00:00
parent 99e0996284
commit 31b15fe8dc
5 changed files with 31 additions and 12 deletions

View File

@ -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;