diff options
Diffstat (limited to 'src/backend/commands/lockcmds.c')
-rw-r--r-- | src/backend/commands/lockcmds.c | 70 |
1 files changed, 0 insertions, 70 deletions
diff --git a/src/backend/commands/lockcmds.c b/src/backend/commands/lockcmds.c deleted file mode 100644 index fe2295cef0f..00000000000 --- a/src/backend/commands/lockcmds.c +++ /dev/null @@ -1,70 +0,0 @@ -/*------------------------------------------------------------------------- - * - * lockcmds.c - * Lock command support code - * - * Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group - * Portions Copyright (c) 1994, Regents of the University of California - * - * - * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/commands/lockcmds.c,v 1.3 2002/06/20 20:29:27 momjian Exp $ - * - *------------------------------------------------------------------------- - */ -#include "postgres.h" - -#include "access/heapam.h" -#include "catalog/namespace.h" -#include "commands/lockcmds.h" -#include "miscadmin.h" -#include "utils/acl.h" -#include "utils/lsyscache.h" - - -/* - * LOCK TABLE - */ -void -LockTableCommand(LockStmt *lockstmt) -{ - List *p; - - /* - * Iterate over the list and open, lock, and close the relations one - * at a time - */ - - foreach(p, lockstmt->relations) - { - RangeVar *relation = lfirst(p); - Oid reloid; - AclResult aclresult; - Relation rel; - - /* - * We don't want to open the relation until we've checked privilege. - * So, manually get the relation OID. - */ - reloid = RangeVarGetRelid(relation, false); - - if (lockstmt->mode == AccessShareLock) - aclresult = pg_class_aclcheck(reloid, GetUserId(), - ACL_SELECT); - else - aclresult = pg_class_aclcheck(reloid, GetUserId(), - ACL_UPDATE | ACL_DELETE); - - if (aclresult != ACLCHECK_OK) - aclcheck_error(aclresult, get_rel_name(reloid)); - - rel = relation_open(reloid, lockstmt->mode); - - /* Currently, we only allow plain tables to be locked */ - if (rel->rd_rel->relkind != RELKIND_RELATION) - elog(ERROR, "LOCK TABLE: %s is not a table", - relation->relname); - - relation_close(rel, NoLock); /* close rel, keep lock */ - } -} |