Commit 4fe42dfb authored by Tom Lane's avatar Tom Lane

Add SHARE UPDATE EXCLUSIVE lock mode, coming soon to a VACUUM near you.

Name chosen per pghackers discussion around 6/22/01.
parent 8902f49a
<!-- <!--
$Header: /cvsroot/pgsql/doc/src/sgml/mvcc.sgml,v 2.15 2001/05/17 21:50:16 petere Exp $ $Header: /cvsroot/pgsql/doc/src/sgml/mvcc.sgml,v 2.16 2001/07/09 22:18:33 tgl Exp $
--> -->
<chapter id="mvcc"> <chapter id="mvcc">
...@@ -441,6 +441,25 @@ ERROR: Can't serialize access due to concurrent update ...@@ -441,6 +441,25 @@ ERROR: Can't serialize access due to concurrent update
</listitem> </listitem>
</varlistentry> </varlistentry>
<varlistentry>
<term>
ShareUpdateExclusiveLock
</term>
<listitem>
<para>
Acquired by <command>VACUUM</command> (without <option>FULL</option>)
and <command>LOCK TABLE</command> table
for <option>IN SHARE UPDATE EXCLUSIVE MODE</option>
statements.
</para>
<para>
Conflicts with ShareUpdateExclusiveLock, ShareLock,
ShareRowExclusiveLock, ExclusiveLock and AccessExclusiveLock modes.
</para>
</listitem>
</varlistentry>
<varlistentry> <varlistentry>
<term> <term>
ShareLock ShareLock
...@@ -454,7 +473,8 @@ ERROR: Can't serialize access due to concurrent update ...@@ -454,7 +473,8 @@ ERROR: Can't serialize access due to concurrent update
</para> </para>
<para> <para>
Conflicts with RowExclusiveLock, ShareRowExclusiveLock, Conflicts with RowExclusiveLock, ShareUpdateExclusiveLock,
ShareRowExclusiveLock,
ExclusiveLock and AccessExclusiveLock modes. ExclusiveLock and AccessExclusiveLock modes.
</para> </para>
</listitem> </listitem>
...@@ -471,7 +491,8 @@ ERROR: Can't serialize access due to concurrent update ...@@ -471,7 +491,8 @@ ERROR: Can't serialize access due to concurrent update
</para> </para>
<para> <para>
Conflicts with RowExclusiveLock, ShareLock, ShareRowExclusiveLock, Conflicts with RowExclusiveLock, ShareUpdateExclusiveLock,
ShareLock, ShareRowExclusiveLock,
ExclusiveLock and AccessExclusiveLock modes. ExclusiveLock and AccessExclusiveLock modes.
</para> </para>
</listitem> </listitem>
...@@ -488,7 +509,8 @@ ERROR: Can't serialize access due to concurrent update ...@@ -488,7 +509,8 @@ ERROR: Can't serialize access due to concurrent update
</para> </para>
<para> <para>
Conflicts with RowShareLock, RowExclusiveLock, ShareLock, Conflicts with RowShareLock, RowExclusiveLock,
ShareUpdateExclusiveLock, ShareLock,
ShareRowExclusiveLock, ExclusiveLock and AccessExclusiveLock ShareRowExclusiveLock, ExclusiveLock and AccessExclusiveLock
modes. modes.
</para> </para>
...@@ -503,13 +525,13 @@ ERROR: Can't serialize access due to concurrent update ...@@ -503,13 +525,13 @@ ERROR: Can't serialize access due to concurrent update
<para> <para>
Acquired by <command>ALTER TABLE</command>, Acquired by <command>ALTER TABLE</command>,
<command>DROP TABLE</command>, <command>DROP TABLE</command>,
<command>VACUUM</command> and <command>LOCK TABLE</command> <command>VACUUM FULL</command> and <command>LOCK TABLE</command>
statements. statements.
</para> </para>
<para> <para>
Conflicts with all modes (AccessShareLock, RowShareLock, Conflicts with all modes (AccessShareLock, RowShareLock,
RowExclusiveLock, ShareLock, RowExclusiveLock, ShareUpdateExclusiveLock, ShareLock,
ShareRowExclusiveLock, ExclusiveLock and AccessExclusiveLock). ShareRowExclusiveLock, ExclusiveLock and AccessExclusiveLock).
</para> </para>
</listitem> </listitem>
......
<!-- <!--
$Header: /cvsroot/pgsql/doc/src/sgml/ref/lock.sgml,v 1.23 2000/12/25 23:15:26 petere Exp $ $Header: /cvsroot/pgsql/doc/src/sgml/ref/lock.sgml,v 1.24 2001/07/09 22:18:33 tgl Exp $
Postgres documentation Postgres documentation
--> -->
...@@ -20,12 +20,16 @@ Postgres documentation ...@@ -20,12 +20,16 @@ Postgres documentation
</refnamediv> </refnamediv>
<refsynopsisdiv> <refsynopsisdiv>
<refsynopsisdivinfo> <refsynopsisdivinfo>
<date>1999-07-20</date> <date>2001-07-09</date>
</refsynopsisdivinfo> </refsynopsisdivinfo>
<synopsis> <synopsis>
LOCK [ TABLE ] <replaceable class="PARAMETER">name</replaceable> LOCK [ TABLE ] <replaceable class="PARAMETER">name</replaceable>
LOCK [ TABLE ] <replaceable class="PARAMETER">name</replaceable> IN [ ROW | ACCESS ] { SHARE | EXCLUSIVE } MODE LOCK [ TABLE ] <replaceable class="PARAMETER">name</replaceable> IN <replaceable class="PARAMETER">lockmode</replaceable> MODE
LOCK [ TABLE ] <replaceable class="PARAMETER">name</replaceable> IN SHARE ROW EXCLUSIVE MODE
where <replaceable class="PARAMETER">lockmode</replaceable> is one of:
ACCESS SHARE | ROW SHARE | ROW EXCLUSIVE | SHARE UPDATE EXCLUSIVE |
SHARE | SHARE ROW EXCLUSIVE | EXCLUSIVE | ACCESS EXCLUSIVE
</synopsis> </synopsis>
<refsect2 id="R2-SQL-LOCK-1"> <refsect2 id="R2-SQL-LOCK-1">
...@@ -33,7 +37,6 @@ LOCK [ TABLE ] <replaceable class="PARAMETER">name</replaceable> IN SHARE ROW EX ...@@ -33,7 +37,6 @@ LOCK [ TABLE ] <replaceable class="PARAMETER">name</replaceable> IN SHARE ROW EX
<date>1999-06-09</date> <date>1999-06-09</date>
</refsect2info> </refsect2info>
<title> <title>
Inputs Inputs
</title> </title>
...@@ -62,7 +65,7 @@ LOCK [ TABLE ] <replaceable class="PARAMETER">name</replaceable> IN SHARE ROW EX ...@@ -62,7 +65,7 @@ LOCK [ TABLE ] <replaceable class="PARAMETER">name</replaceable> IN SHARE ROW EX
This is the least restrictive lock mode. It conflicts only with This is the least restrictive lock mode. It conflicts only with
ACCESS EXCLUSIVE mode. It is used to protect a table from being ACCESS EXCLUSIVE mode. It is used to protect a table from being
modified by concurrent <command>ALTER TABLE</command>, modified by concurrent <command>ALTER TABLE</command>,
<command>DROP TABLE</command> and <command>VACUUM</command> <command>DROP TABLE</command> and <command>VACUUM FULL</command>
commands. commands.
</para> </para>
</listitem> </listitem>
...@@ -102,6 +105,25 @@ LOCK [ TABLE ] <replaceable class="PARAMETER">name</replaceable> IN SHARE ROW EX ...@@ -102,6 +105,25 @@ LOCK [ TABLE ] <replaceable class="PARAMETER">name</replaceable> IN SHARE ROW EX
</listitem> </listitem>
</varlistentry> </varlistentry>
<varlistentry>
<term>SHARE UPDATE EXCLUSIVE MODE</term>
<listitem>
<note>
<para>
Automatically acquired by <command>VACUUM</command> (without
<option>FULL</option>).
</para>
</note>
<para>
Conflicts with SHARE UPDATE EXCLUSIVE, SHARE, SHARE ROW EXCLUSIVE,
EXCLUSIVE and
ACCESS EXCLUSIVE modes. This mode protects a table against
concurrent schema changes and VACUUMs.
</para>
</listitem>
</varlistentry>
<varlistentry> <varlistentry>
<term>SHARE MODE</term> <term>SHARE MODE</term>
<listitem> <listitem>
...@@ -113,9 +135,10 @@ LOCK [ TABLE ] <replaceable class="PARAMETER">name</replaceable> IN SHARE ROW EX ...@@ -113,9 +135,10 @@ LOCK [ TABLE ] <replaceable class="PARAMETER">name</replaceable> IN SHARE ROW EX
</note> </note>
<para> <para>
Conflicts with ROW EXCLUSIVE, SHARE ROW EXCLUSIVE, EXCLUSIVE and Conflicts with ROW EXCLUSIVE, SHARE UPDATE EXCLUSIVE,
SHARE ROW EXCLUSIVE, EXCLUSIVE and
ACCESS EXCLUSIVE modes. This mode protects a table against ACCESS EXCLUSIVE modes. This mode protects a table against
concurrent updates. concurrent data updates.
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
...@@ -125,14 +148,14 @@ LOCK [ TABLE ] <replaceable class="PARAMETER">name</replaceable> IN SHARE ROW EX ...@@ -125,14 +148,14 @@ LOCK [ TABLE ] <replaceable class="PARAMETER">name</replaceable> IN SHARE ROW EX
<listitem> <listitem>
<note> <note>
<para> <para>
This is like EXCLUSIVE MODE, but allows SHARE ROW locks This is like EXCLUSIVE MODE, but allows ROW SHARE locks
by others. by others.
</para> </para>
</note> </note>
<para> <para>
Conflicts with ROW EXCLUSIVE, SHARE, SHARE ROW EXCLUSIVE, Conflicts with ROW EXCLUSIVE, SHARE UPDATE EXCLUSIVE, SHARE,
EXCLUSIVE and ACCESS EXCLUSIVE modes. SHARE ROW EXCLUSIVE, EXCLUSIVE and ACCESS EXCLUSIVE modes.
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
...@@ -149,7 +172,8 @@ LOCK [ TABLE ] <replaceable class="PARAMETER">name</replaceable> IN SHARE ROW EX ...@@ -149,7 +172,8 @@ LOCK [ TABLE ] <replaceable class="PARAMETER">name</replaceable> IN SHARE ROW EX
</note> </note>
<para> <para>
Conflicts with ROW SHARE, ROW EXCLUSIVE, SHARE, SHARE ROW EXCLUSIVE, Conflicts with ROW SHARE, ROW EXCLUSIVE, SHARE UPDATE EXCLUSIVE,
SHARE, SHARE ROW EXCLUSIVE,
EXCLUSIVE and ACCESS EXCLUSIVE modes. EXCLUSIVE and ACCESS EXCLUSIVE modes.
</para> </para>
</listitem> </listitem>
...@@ -161,9 +185,10 @@ LOCK [ TABLE ] <replaceable class="PARAMETER">name</replaceable> IN SHARE ROW EX ...@@ -161,9 +185,10 @@ LOCK [ TABLE ] <replaceable class="PARAMETER">name</replaceable> IN SHARE ROW EX
<note> <note>
<para> <para>
Automatically acquired by <command>ALTER TABLE</command>, Automatically acquired by <command>ALTER TABLE</command>,
<command>DROP TABLE</command>, <command>VACUUM</command> statements. <command>DROP TABLE</command>, <command>VACUUM FULL</command>
This is the most restrictive lock mode which conflicts with all other statements.
lock modes and protects a locked table from any concurrent operations. This is the most restrictive lock mode which
protects a locked table from any concurrent operations.
</para> </para>
</note> </note>
...@@ -174,6 +199,10 @@ LOCK [ TABLE ] <replaceable class="PARAMETER">name</replaceable> IN SHARE ROW EX ...@@ -174,6 +199,10 @@ LOCK [ TABLE ] <replaceable class="PARAMETER">name</replaceable> IN SHARE ROW EX
lock mode option). lock mode option).
</para> </para>
</note> </note>
<para>
Conflicts with all lock modes.
</para>
</listitem> </listitem>
</varlistentry> </varlistentry>
</variablelist> </variablelist>
...@@ -241,7 +270,11 @@ ERROR <replaceable class="PARAMETER">name</replaceable>: Table does not exist. ...@@ -241,7 +270,11 @@ ERROR <replaceable class="PARAMETER">name</replaceable>: Table does not exist.
<term>EXCLUSIVE</term> <term>EXCLUSIVE</term>
<listitem> <listitem>
<para> <para>
Exclusive lock that prevents other locks from being granted. An exclusive lock prevents other locks of the same type from being
granted. (Note: ROW EXCLUSIVE mode does not follow this naming
convention perfectly, since it is shared at the level of the table;
it is exclusive only with respect to specific rows that are being
updated.)
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
...@@ -250,7 +283,8 @@ ERROR <replaceable class="PARAMETER">name</replaceable>: Table does not exist. ...@@ -250,7 +283,8 @@ ERROR <replaceable class="PARAMETER">name</replaceable>: Table does not exist.
<term>SHARE</term> <term>SHARE</term>
<listitem> <listitem>
<para> <para>
Allows others to share lock. Prevents EXCLUSIVE locks. A shared lock allows others to also hold the same type of lock,
but prevents the corresponding EXCLUSIVE lock from being granted.
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
...@@ -273,13 +307,6 @@ ERROR <replaceable class="PARAMETER">name</replaceable>: Table does not exist. ...@@ -273,13 +307,6 @@ ERROR <replaceable class="PARAMETER">name</replaceable>: Table does not exist.
</listitem> </listitem>
</varlistentry> </varlistentry>
</variablelist> </variablelist>
<note>
<para>
If EXCLUSIVE or SHARE are not specified, EXCLUSIVE is assumed.
Locks exist for the duration of the transaction.
</para>
</note>
</para> </para>
<para> <para>
...@@ -370,8 +397,8 @@ ERROR <replaceable class="PARAMETER">name</replaceable>: Table does not exist. ...@@ -370,8 +397,8 @@ ERROR <replaceable class="PARAMETER">name</replaceable>: Table does not exist.
</para> </para>
<para> <para>
Except for ACCESS SHARE/EXCLUSIVE lock modes, all other Except for ACCESS SHARE, ACCESS EXCLUSIVE, and SHARE UPDATE EXCLUSIVE lock
<productname>Postgres</productname> lock modes and the modes, the <productname>Postgres</productname> lock modes and the
<command>LOCK TABLE</command> syntax are compatible with those <command>LOCK TABLE</command> syntax are compatible with those
present in <productname>Oracle</productname>. present in <productname>Oracle</productname>.
</para> </para>
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/parser/gram.y,v 2.233 2001/06/30 22:03:25 petere Exp $ * $Header: /cvsroot/pgsql/src/backend/parser/gram.y,v 2.234 2001/07/09 22:18:33 tgl Exp $
* *
* HISTORY * HISTORY
* AUTHOR DATE MAJOR EVENT * AUTHOR DATE MAJOR EVENT
...@@ -153,7 +153,7 @@ static void doNegateFloat(Value *v); ...@@ -153,7 +153,7 @@ static void doNegateFloat(Value *v);
%type <list> createdb_opt_list, createdb_opt_item %type <list> createdb_opt_list, createdb_opt_item
%type <ival> opt_lock, lock_type %type <ival> opt_lock, lock_type
%type <boolean> opt_lmode, opt_force %type <boolean> opt_force
%type <ival> user_createdb_clause, user_createuser_clause %type <ival> user_createdb_clause, user_createuser_clause
%type <str> user_passwd_clause %type <str> user_passwd_clause
...@@ -3277,18 +3277,18 @@ LockStmt: LOCK_P opt_table relation_name opt_lock ...@@ -3277,18 +3277,18 @@ LockStmt: LOCK_P opt_table relation_name opt_lock
} }
; ;
opt_lock: IN lock_type MODE { $$ = $2; } opt_lock: IN lock_type MODE { $$ = $2; }
| /*EMPTY*/ { $$ = AccessExclusiveLock; } | /*EMPTY*/ { $$ = AccessExclusiveLock; }
; ;
lock_type: SHARE ROW EXCLUSIVE { $$ = ShareRowExclusiveLock; } lock_type: ACCESS SHARE { $$ = AccessShareLock; }
| ROW opt_lmode { $$ = ($2? RowShareLock: RowExclusiveLock); } | ROW SHARE { $$ = RowShareLock; }
| ACCESS opt_lmode { $$ = ($2? AccessShareLock: AccessExclusiveLock); } | ROW EXCLUSIVE { $$ = RowExclusiveLock; }
| opt_lmode { $$ = ($1? ShareLock: ExclusiveLock); } | SHARE UPDATE EXCLUSIVE { $$ = ShareUpdateExclusiveLock; }
; | SHARE { $$ = ShareLock; }
| SHARE ROW EXCLUSIVE { $$ = ShareRowExclusiveLock; }
opt_lmode: SHARE { $$ = TRUE; } | EXCLUSIVE { $$ = ExclusiveLock; }
| EXCLUSIVE { $$ = FALSE; } | ACCESS EXCLUSIVE { $$ = AccessExclusiveLock; }
; ;
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/storage/lmgr/lmgr.c,v 1.48 2001/06/22 00:04:59 tgl Exp $ * $Header: /cvsroot/pgsql/src/backend/storage/lmgr/lmgr.c,v 1.49 2001/07/09 22:18:33 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -33,25 +33,35 @@ static LOCKMASK LockConflicts[] = { ...@@ -33,25 +33,35 @@ static LOCKMASK LockConflicts[] = {
(1 << ExclusiveLock) | (1 << AccessExclusiveLock), (1 << ExclusiveLock) | (1 << AccessExclusiveLock),
/* RowExclusiveLock */ /* RowExclusiveLock */
(1 << ExclusiveLock) | (1 << ShareRowExclusiveLock) | (1 << ShareLock) | (1 << ShareLock) | (1 << ShareRowExclusiveLock) |
(1 << AccessExclusiveLock), (1 << ExclusiveLock) | (1 << AccessExclusiveLock),
/* ShareUpdateExclusiveLock */
(1 << ShareUpdateExclusiveLock) |
(1 << ShareLock) | (1 << ShareRowExclusiveLock) |
(1 << ExclusiveLock) | (1 << AccessExclusiveLock),
/* ShareLock */ /* ShareLock */
(1 << ExclusiveLock) | (1 << ShareRowExclusiveLock) | (1 << RowExclusiveLock) | (1 << ShareUpdateExclusiveLock) |
(1 << RowExclusiveLock) | (1 << AccessExclusiveLock), (1 << ShareRowExclusiveLock) |
(1 << ExclusiveLock) | (1 << AccessExclusiveLock),
/* ShareRowExclusiveLock */ /* ShareRowExclusiveLock */
(1 << ExclusiveLock) | (1 << ShareRowExclusiveLock) | (1 << RowExclusiveLock) | (1 << ShareUpdateExclusiveLock) |
(1 << ShareLock) | (1 << RowExclusiveLock) | (1 << AccessExclusiveLock), (1 << ShareLock) | (1 << ShareRowExclusiveLock) |
(1 << ExclusiveLock) | (1 << AccessExclusiveLock),
/* ExclusiveLock */ /* ExclusiveLock */
(1 << ExclusiveLock) | (1 << ShareRowExclusiveLock) | (1 << ShareLock) | (1 << RowShareLock) |
(1 << RowExclusiveLock) | (1 << RowShareLock) | (1 << AccessExclusiveLock), (1 << RowExclusiveLock) | (1 << ShareUpdateExclusiveLock) |
(1 << ShareLock) | (1 << ShareRowExclusiveLock) |
(1 << ExclusiveLock) | (1 << AccessExclusiveLock),
/* AccessExclusiveLock */ /* AccessExclusiveLock */
(1 << ExclusiveLock) | (1 << ShareRowExclusiveLock) | (1 << ShareLock) | (1 << AccessShareLock) | (1 << RowShareLock) |
(1 << RowExclusiveLock) | (1 << RowShareLock) | (1 << RowExclusiveLock) | (1 << ShareUpdateExclusiveLock) |
(1 << AccessExclusiveLock) | (1 << AccessShareLock) (1 << ShareLock) | (1 << ShareRowExclusiveLock) |
(1 << ExclusiveLock) | (1 << AccessExclusiveLock)
}; };
...@@ -63,14 +73,16 @@ static int LockPrios[] = { ...@@ -63,14 +73,16 @@ static int LockPrios[] = {
2, 2,
/* RowExclusiveLock */ /* RowExclusiveLock */
3, 3,
/* ShareLock */ /* ShareUpdateExclusiveLock */
4, 4,
/* ShareRowExclusiveLock */ /* ShareLock */
5, 5,
/* ExclusiveLock */ /* ShareRowExclusiveLock */
6, 6,
/* ExclusiveLock */
7,
/* AccessExclusiveLock */ /* AccessExclusiveLock */
7 8
}; };
LOCKMETHOD LockTableId = (LOCKMETHOD) NULL; LOCKMETHOD LockTableId = (LOCKMETHOD) NULL;
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/storage/lmgr/lock.c,v 1.90 2001/06/27 23:31:39 tgl Exp $ * $Header: /cvsroot/pgsql/src/backend/storage/lmgr/lock.c,v 1.91 2001/07/09 22:18:33 tgl Exp $
* *
* NOTES * NOTES
* Outside modules can create a lock table and acquire/release * Outside modules can create a lock table and acquire/release
...@@ -58,6 +58,7 @@ static char *lock_mode_names[] = ...@@ -58,6 +58,7 @@ static char *lock_mode_names[] =
"AccessShareLock", "AccessShareLock",
"RowShareLock", "RowShareLock",
"RowExclusiveLock", "RowExclusiveLock",
"ShareUpdateExclusiveLock",
"ShareLock", "ShareLock",
"ShareRowExclusiveLock", "ShareRowExclusiveLock",
"ExclusiveLock", "ExclusiveLock",
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group * Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California * Portions Copyright (c) 1994, Regents of the University of California
* *
* $Id: lmgr.h,v 1.31 2001/06/22 00:04:59 tgl Exp $ * $Id: lmgr.h,v 1.32 2001/07/09 22:18:34 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -25,13 +25,14 @@ ...@@ -25,13 +25,14 @@
#define AccessShareLock 1 /* SELECT */ #define AccessShareLock 1 /* SELECT */
#define RowShareLock 2 /* SELECT FOR UPDATE */ #define RowShareLock 2 /* SELECT FOR UPDATE */
#define RowExclusiveLock 3 /* INSERT, UPDATE, DELETE */ #define RowExclusiveLock 3 /* INSERT, UPDATE, DELETE */
#define ShareLock 4 /* CREATE INDEX */ #define ShareUpdateExclusiveLock 4 /* VACUUM (non-FULL) */
#define ShareRowExclusiveLock 5 /* like EXCLUSIVE MODE, allows #define ShareLock 5 /* CREATE INDEX */
* SHARE ROW */ #define ShareRowExclusiveLock 6 /* like EXCLUSIVE MODE, but allows
#define ExclusiveLock 6 /* blocks ROW SHARE/SELECT...FOR * ROW SHARE */
#define ExclusiveLock 7 /* blocks ROW SHARE/SELECT...FOR
* UPDATE */ * UPDATE */
#define AccessExclusiveLock 7 /* ALTER TABLE, DROP TABLE, #define AccessExclusiveLock 8 /* ALTER TABLE, DROP TABLE,
* VACUUM, and unqualified LOCK * VACUUM FULL, and unqualified LOCK
* TABLE */ * TABLE */
/* /*
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group * Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California * Portions Copyright (c) 1994, Regents of the University of California
* *
* $Id: lock.h,v 1.50 2001/06/27 23:31:39 tgl Exp $ * $Id: lock.h,v 1.51 2001/07/09 22:18:34 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -49,7 +49,7 @@ typedef int LOCKMODE; ...@@ -49,7 +49,7 @@ typedef int LOCKMODE;
typedef int LOCKMETHOD; typedef int LOCKMETHOD;
/* MAX_LOCKMODES cannot be larger than the # of bits in LOCKMASK */ /* MAX_LOCKMODES cannot be larger than the # of bits in LOCKMASK */
#define MAX_LOCKMODES 8 #define MAX_LOCKMODES 10
/* /*
* MAX_LOCK_METHODS corresponds to the number of spin locks allocated in * MAX_LOCK_METHODS corresponds to the number of spin locks allocated in
...@@ -91,7 +91,7 @@ typedef int LOCKMETHOD; ...@@ -91,7 +91,7 @@ typedef int LOCKMETHOD;
* *
* prio -- each lockmode has a priority, so, for example, waiting * prio -- each lockmode has a priority, so, for example, waiting
* writers can be given priority over readers (to avoid * writers can be given priority over readers (to avoid
* starvation). * starvation). XXX this field is not actually used at present!
* *
* masterlock -- synchronizes access to the table * masterlock -- synchronizes access to the table
*/ */
......
...@@ -326,7 +326,7 @@ make_name(void) ...@@ -326,7 +326,7 @@ make_name(void)
%type <str> createdb_opt_list opt_encoding OptInherit Geometric %type <str> createdb_opt_list opt_encoding OptInherit Geometric
%type <str> DropdbStmt ClusterStmt grantee RevokeStmt Bit bit %type <str> DropdbStmt ClusterStmt grantee RevokeStmt Bit bit
%type <str> GrantStmt privileges operation_commalist operation PosAllConst %type <str> GrantStmt privileges operation_commalist operation PosAllConst
%type <str> opt_cursor opt_lmode ConstraintsSetStmt comment_tg AllConst %type <str> opt_cursor ConstraintsSetStmt comment_tg AllConst
%type <str> case_expr when_clause_list case_default case_arg when_clause %type <str> case_expr when_clause_list case_default case_arg when_clause
%type <str> select_clause opt_select_limit select_limit_value ConstraintTimeSpec %type <str> select_clause opt_select_limit select_limit_value ConstraintTimeSpec
%type <str> select_offset_value ReindexStmt join_type opt_boolean %type <str> select_offset_value ReindexStmt join_type opt_boolean
...@@ -2440,15 +2440,15 @@ opt_lock: IN lock_type MODE { $$ = cat_str(3, make_str("in"), $2, ma ...@@ -2440,15 +2440,15 @@ opt_lock: IN lock_type MODE { $$ = cat_str(3, make_str("in"), $2, ma
| /*EMPTY*/ { $$ = EMPTY;} | /*EMPTY*/ { $$ = EMPTY;}
; ;
lock_type: SHARE ROW EXCLUSIVE { $$ = make_str("share row exclusive"); } lock_type: ACCESS SHARE { $$ = make_str("access share"); }
| ROW opt_lmode { $$ = cat2_str(make_str("row"), $2);} | ROW SHARE { $$ = make_str("access share"); }
| ACCESS opt_lmode { $$ = cat2_str(make_str("access"), $2);} | ROW EXCLUSIVE { $$ = make_str("row exclusive"); }
| opt_lmode { $$ = $1; } | SHARE UPDATE EXCLUSIVE { $$ = make_str("share update exclusive"); }
; | SHARE { $$ = make_str("share"); }
| SHARE ROW EXCLUSIVE { $$ = make_str("share row exclusive"); }
opt_lmode: SHARE { $$ = make_str("share"); } | EXCLUSIVE { $$ = make_str("exclusive"); }
| EXCLUSIVE { $$ = make_str("exclusive"); } | ACCESS EXCLUSIVE { $$ = make_str("access exclusive"); }
; ;
/***************************************************************************** /*****************************************************************************
* *
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment