File applock-1c-9.2.patch of Package postgresql92-libs

--- ../postgresql-9.2.0.orig/doc/src/sgml/ref/lock.sgml	2011-09-09 01:13:28.000000000 +0400
+++ ./doc/src/sgml/ref/lock.sgml	2011-09-14 21:05:06.902050800 +0400
@@ -27,6 +27,7 @@
 
     ACCESS SHARE | ROW SHARE | ROW EXCLUSIVE | SHARE UPDATE EXCLUSIVE
     | SHARE | SHARE ROW EXCLUSIVE | EXCLUSIVE | ACCESS EXCLUSIVE
+    | APPLICATION SHARE | APPLICATION EXCLUSIVE
 </synopsis>
  </refsynopsisdiv>
 

--- ../postgresql-9.2.0.orig/src/backend/parser/gram.y	2011-09-09 01:13:28.000000000 +0400
+++ ./src/backend/parser/gram.y	2011-09-14 21:38:48.694882400 +0400
@@ -488,7 +488,7 @@
 
 /* ordinary key words in alphabetical order */
 %token <keyword> ABORT_P ABSOLUTE_P ACCESS ACTION ADD_P ADMIN AFTER
-	AGGREGATE ALL ALSO ALTER ALWAYS ANALYSE ANALYZE AND ANY ARRAY AS ASC
+	AGGREGATE ALL ALSO ALTER ALWAYS ANALYSE ANALYZE AND ANY APPLICATION ARRAY AS ASC
 	ASSERTION ASSIGNMENT ASYMMETRIC AT ATTRIBUTE AUTHORIZATION
 
 	BACKWARD BEFORE BEGIN_P BETWEEN BIGINT BINARY BIT
@@ -8139,6 +8139,8 @@
 lock_type:	ACCESS SHARE					{ $$ = AccessShareLock; }
 			| ROW SHARE						{ $$ = RowShareLock; }
 			| ROW EXCLUSIVE					{ $$ = RowExclusiveLock; }
+			| APPLICATION SHARE             { $$ = ApplicationShareLock; }
+			| APPLICATION EXCLUSIVE         { $$ = ApplicationExclusiveLock; }
 			| SHARE UPDATE EXCLUSIVE		{ $$ = ShareUpdateExclusiveLock; }
 			| SHARE							{ $$ = ShareLock; }
 			| SHARE ROW EXCLUSIVE			{ $$ = ShareRowExclusiveLock; }
@@ -11828,6 +11830,7 @@
 			| ALSO
 			| ALTER
 			| ALWAYS
+			| APPLICATION
 			| ASSERTION
 			| ASSIGNMENT
 			| AT
--- --- ../postgresql-9.2.0.orig/src/backend/storage/lmgr/lock.c	Thu Aug 23 22:06:50 2012 UTC
+++ ./src/backend/storage/lmgr/lock.c	Mon Sep 10 07:35:10 2012 UTC
@@ -96,8 +96,14 @@
 	(1 << AccessShareLock) | (1 << RowShareLock) |
 	(1 << RowExclusiveLock) | (1 << ShareUpdateExclusiveLock) |
 	(1 << ShareLock) | (1 << ShareRowExclusiveLock) |
-	(1 << ExclusiveLock) | (1 << AccessExclusiveLock)
+	(1 << ExclusiveLock) | (1 << AccessExclusiveLock),
+
+    /* ApplicationShareLock*/
+    (1 << ApplicationExclusiveLock),
+
 
+    /* ApplicationExclusiveLock*/
+    (1 << ApplicationExclusiveLock | 1 << ApplicationShareLock)
 };
 
 /* Names of lock modes, for debug printouts */
@@ -111,7 +117,9 @@
 	"ShareLock",
 	"ShareRowExclusiveLock",
 	"ExclusiveLock",
-	"AccessExclusiveLock"
+	"AccessExclusiveLock",
+    "ApplicationShareLock",
+    "ApplicationExclusiveLock"
 };
 
 #ifndef LOCK_DEBUG
@@ -119,7 +127,7 @@
 #endif
 
 static const LockMethodData default_lockmethod = {
-	AccessExclusiveLock,		/* highest valid lock mode number */
+	ApplicationExclusiveLock,		/* highest valid lock mode number */
 	LockConflicts,
 	lock_mode_names,
 #ifdef LOCK_DEBUG
@@ -130,7 +138,7 @@
 };
 
 static const LockMethodData user_lockmethod = {
-	AccessExclusiveLock,		/* highest valid lock mode number */
+	ApplicationExclusiveLock,		/* highest valid lock mode number */
 	LockConflicts,
 	lock_mode_names,
 #ifdef LOCK_DEBUG
--- ../postgresql-9.2.0.orig/src/include/parser/kwlist.h	2011-09-09 01:13:28.000000000 +0400
+++ ./src/include/parser/kwlist.h	2011-09-14 19:40:30.858423500 +0400
@@ -42,6 +42,7 @@
 PG_KEYWORD("analyze", ANALYZE, RESERVED_KEYWORD)
 PG_KEYWORD("and", AND, RESERVED_KEYWORD)
 PG_KEYWORD("any", ANY, RESERVED_KEYWORD)
+PG_KEYWORD("application", APPLICATION, UNRESERVED_KEYWORD)
 PG_KEYWORD("array", ARRAY, RESERVED_KEYWORD)
 PG_KEYWORD("as", AS, RESERVED_KEYWORD)
 PG_KEYWORD("asc", ASC, RESERVED_KEYWORD)

--- ../postgresql-9.2.0_orig/src/include/storage/lock.h	2011-09-09 01:13:28.000000000 +0400
+++ ./src/include/storage/lock.h	2011-09-14 19:40:30.905223600 +0400
@@ -87,7 +87,7 @@
 typedef int LOCKMODE;
 
 /* MAX_LOCKMODES cannot be larger than the # of bits in LOCKMASK */
-#define MAX_LOCKMODES		10
+#define MAX_LOCKMODES		12
 
 #define LOCKBIT_ON(lockmode) (1 << (lockmode))
 #define LOCKBIT_OFF(lockmode) (~(1 << (lockmode)))
@@ -156,6 +156,9 @@
 #define AccessExclusiveLock		8		/* ALTER TABLE, DROP TABLE, VACUUM
 										 * FULL, and unqualified LOCK TABLE */
 
+#define ApplicationShareLock       9   /* requested explicitly */
+#define ApplicationExclusiveLock   10  /* requested explicitly */
+
 
 /*
  * LOCKTAG is the key information needed to look up a LOCK item in the