⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 lockcmds.c

📁 PostgreSQL 8.1.4的源码 适用于Linux下的开源数据库系统
💻 C
字号:
/*------------------------------------------------------------------------- * * lockcmds.c *	  Lock command support code * * Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * * IDENTIFICATION *	  $PostgreSQL: pgsql/src/backend/commands/lockcmds.c,v 1.13 2005/10/15 02:49:15 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 */voidLockTableCommand(LockStmt *lockstmt){	ListCell   *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, ACL_KIND_CLASS,						   get_rel_name(reloid));		rel = conditional_relation_open(reloid, lockstmt->mode, lockstmt->nowait);		/* Currently, we only allow plain tables to be locked */		if (rel->rd_rel->relkind != RELKIND_RELATION)			ereport(ERROR,					(errcode(ERRCODE_WRONG_OBJECT_TYPE),					 errmsg("\"%s\" is not a table",							relation->relname)));		relation_close(rel, NoLock);	/* close rel, keep lock */	}}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -