PostgreSQL Source Code  git master
lockcmds.h File Reference
#include "nodes/parsenodes.h"
Include dependency graph for lockcmds.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.


void LockTableCommand (LockStmt *lockstmt)

Function Documentation

◆ LockTableCommand()

void LockTableCommand ( LockStmt lockstmt)

Definition at line 41 of file lockcmds.c.

References get_rel_relkind(), RangeVar::inh, lfirst, LockTableRecurse(), LockViewRecurse(), LockStmt::mode, NIL, LockStmt::nowait, RangeVarCallbackForLockTable(), RangeVarGetRelidExtended(), LockStmt::relations, and RVR_NOWAIT.

Referenced by standard_ProcessUtility().

42 {
43  ListCell *p;
45  /*
46  * Iterate over the list and process the named relations one at a time
47  */
48  foreach(p, lockstmt->relations)
49  {
50  RangeVar *rv = (RangeVar *) lfirst(p);
51  bool recurse = rv->inh;
52  Oid reloid;
54  reloid = RangeVarGetRelidExtended(rv, lockstmt->mode,
55  lockstmt->nowait ? RVR_NOWAIT : 0,
57  (void *) &lockstmt->mode);
59  if (get_rel_relkind(reloid) == RELKIND_VIEW)
60  LockViewRecurse(reloid, lockstmt->mode, lockstmt->nowait, NIL);
61  else if (recurse)
62  LockTableRecurse(reloid, lockstmt->mode, lockstmt->nowait);
63  }
64 }
#define NIL
Definition: pg_list.h:65
bool nowait
Definition: parsenodes.h:3334
char get_rel_relkind(Oid relid)
Definition: lsyscache.c:1915
static void LockViewRecurse(Oid reloid, LOCKMODE lockmode, bool nowait, List *ancestor_views)
Definition: lockcmds.c:248
unsigned int Oid
Definition: postgres_ext.h:31
Oid RangeVarGetRelidExtended(const RangeVar *relation, LOCKMODE lockmode, uint32 flags, RangeVarGetRelidCallback callback, void *callback_arg)
Definition: namespace.c:236
bool inh
Definition: primnodes.h:69
static void LockTableRecurse(Oid reloid, LOCKMODE lockmode, bool nowait)
Definition: lockcmds.c:116
List * relations
Definition: parsenodes.h:3332
#define lfirst(lc)
Definition: pg_list.h:190
static void RangeVarCallbackForLockTable(const RangeVar *rv, Oid relid, Oid oldrelid, void *arg)
Definition: lockcmds.c:71