LOCK

Synopsis

Use the LOCK statement to lock a table.

Syntax

lock_table ::= LOCK [ TABLE ] { table_expr [ , ... ] } 
               [ IN lockmode MODE ] [ NOWAIT ]

lockmode ::= ACCESS SHARE
             | ROW SHARE
             | ROW EXCLUSIVE
             | SHARE UPDATE EXCLUSIVE
             | SHARE
             | SHARE ROW EXCLUSIVE
             | EXCLUSIVE
             | ACCESS EXCLUSIVE

lock_table

LOCKTABLE,table_exprINlockmodeMODENOWAIT

lockmode

ACCESSSHAREROWSHAREROWEXCLUSIVESHAREUPDATEEXCLUSIVESHARESHAREROWEXCLUSIVEEXCLUSIVEACCESSEXCLUSIVE

Table inheritance is not yet supported

The table_expr rule specifies syntax that is useful only when at least one other table inherits one of the tables that the truncate statement lists explicitly. See this note for more detail. Until inheritance is supported, use a bare table_name.

Semantics

lock_table

name

Specify a table to lock.

lockmode

  • Only ACCESS SHARE lock mode is supported at this time.
  • All other modes listed in lockmode are under development.
ACCESS SHARE
  | ROW SHARE
  | ROW EXCLUSIVE
  | SHARE UPDATE EXCLUSIVE
  | SHARE
  | SHARE ROW EXCLUSIVE
  | EXCLUSIVE
  | ACCESS EXCLUSIVE

See also