From 97908d89c130b5e3e15403d7d597793b3f11ac22 Mon Sep 17 00:00:00 2001
From: Emre Hasegeli <emre@hasegeli.com>
Date: Sun, 22 Mar 2015 17:30:05 +0100
Subject: [PATCH 2/7] strategy numbers

---
 src/include/access/gist.h | 20 --------------------
 src/include/access/skey.h | 34 ++++++++++++++++++++++++++++++++++
 2 files changed, 34 insertions(+), 20 deletions(-)

diff --git a/src/include/access/gist.h b/src/include/access/gist.h
index 50261b8..81e559b 100644
--- a/src/include/access/gist.h
+++ b/src/include/access/gist.h
@@ -30,40 +30,20 @@
 #define GIST_COMPRESS_PROC				3
 #define GIST_DECOMPRESS_PROC			4
 #define GIST_PENALTY_PROC				5
 #define GIST_PICKSPLIT_PROC				6
 #define GIST_EQUAL_PROC					7
 #define GIST_DISTANCE_PROC				8
 #define GIST_FETCH_PROC					9
 #define GISTNProcs					9
 
 /*
- * strategy numbers for GiST opclasses that want to implement the old
- * RTREE behavior.
- */
-#define RTLeftStrategyNumber			1
-#define RTOverLeftStrategyNumber		2
-#define RTOverlapStrategyNumber			3
-#define RTOverRightStrategyNumber		4
-#define RTRightStrategyNumber			5
-#define RTSameStrategyNumber			6
-#define RTContainsStrategyNumber		7		/* for @> */
-#define RTContainedByStrategyNumber		8		/* for <@ */
-#define RTOverBelowStrategyNumber		9
-#define RTBelowStrategyNumber			10
-#define RTAboveStrategyNumber			11
-#define RTOverAboveStrategyNumber		12
-#define RTOldContainsStrategyNumber		13		/* for old spelling of @> */
-#define RTOldContainedByStrategyNumber	14		/* for old spelling of <@ */
-#define RTKNNSearchStrategyNumber		15
-
-/*
  * Page opaque data in a GiST index page.
  */
 #define F_LEAF				(1 << 0)	/* leaf page */
 #define F_DELETED			(1 << 1)	/* the page has been deleted */
 #define F_TUPLES_DELETED	(1 << 2)	/* some tuples on the page are dead */
 #define F_FOLLOW_RIGHT		(1 << 3)	/* page to the right has no downlink */
 
 typedef XLogRecPtr GistNSN;
 
 /*
diff --git a/src/include/access/skey.h b/src/include/access/skey.h
index eeee1f4..487a928 100644
--- a/src/include/access/skey.h
+++ b/src/include/access/skey.h
@@ -34,20 +34,54 @@ typedef uint16 StrategyNumber;
 #define BTLessStrategyNumber			1
 #define BTLessEqualStrategyNumber		2
 #define BTEqualStrategyNumber			3
 #define BTGreaterEqualStrategyNumber	4
 #define BTGreaterStrategyNumber			5
 
 #define BTMaxStrategyNumber				5
 
 
 /*
+ * Strategy numbers for opclasses that want to implement the old RTREE behavior.
+ * Operator strategy numbers used in the GiST, SP-GiST, GIN, BRIN  opclasses.
+ * New numbers are chosen to match up operator names with existing usages.
+ */
+#define RTLeftStrategyNumber			1		/* for << */
+#define RTOverLeftStrategyNumber		2		/* for &< */
+#define RTOverlapStrategyNumber			3		/* for && */
+#define RTOverRightStrategyNumber		4		/* for &> */
+#define RTRightStrategyNumber			5		/* for >> */
+#define RTSameStrategyNumber			6		/* for ~= */
+#define RTContainsStrategyNumber		7		/* for @> */
+#define RTContainedByStrategyNumber		8		/* for <@ */
+#define RTOverBelowStrategyNumber		9		/* for &<| */
+#define RTBelowStrategyNumber			10		/* for <<| */
+#define RTAboveStrategyNumber			11		/* for |>> */
+#define RTOverAboveStrategyNumber		12		/* for |&> */
+#define RTOldContainsStrategyNumber		13		/* for old spelling of @> */
+#define RTOldContainedByStrategyNumber	14		/* for old spelling of <@ */
+#define RTKNNSearchStrategyNumber		15
+#define RTContainsElemStrategyNumber	16		/* for range types @> elem */
+#define RTAdjacentStrategyNumber		17		/* for -|- */
+#define RTEqualStrategyNumber			18		/* for = */
+#define RTNotEqualStrategyNumber		19		/* for != */
+#define RTLessStrategyNumber			20		/* for < */
+#define RTLessEqualStrategyNumber		21		/* for <= */
+#define RTGreaterStrategyNumber			22		/* for > */
+#define RTGreaterEqualStrategyNumber	23		/* for >= */
+#define RTContainsNotEqualStrategyNumber	24	/* for inet >> */
+#define RTContainedByNotEqualStrategyNumber	26	/* for inet << */
+
+#define RTMaxStrategyNumber				26
+
+
+/*
  * A ScanKey represents the application of a comparison operator between
  * a table or index column and a constant.  When it's part of an array of
  * ScanKeys, the comparison conditions are implicitly ANDed.  The index
  * column is the left argument of the operator, if it's a binary operator.
  * (The data structure can support unary indexable operators too; in that
  * case sk_argument would go unused.  This is not currently implemented.)
  *
  * For an index scan, sk_strategy and sk_subtype must be set correctly for
  * the operator.  When using a ScanKey in a heap scan, these fields are not
  * used and may be set to InvalidStrategy/InvalidOid.
-- 
2.3.2

