@@ -42,16 +42,37 @@ fullhash_##type(PG_FUNCTION_ARGS) { \
42
42
) ); \
43
43
}
44
44
45
+ static Datum
46
+ hashint2vector (PG_FUNCTION_ARGS )
47
+ {
48
+ int2vector * key = (int2vector * ) PG_GETARG_POINTER (0 );
49
+
50
+ return hash_any ((unsigned char * ) key -> values , key -> dim1 * sizeof (int16 ));
51
+ }
52
+
53
+ /*
54
+ * We don't have a complete set of int2vector support routines,
55
+ * but we need int2vectoreq for catcache indexing.
56
+ */
57
+ static Datum
58
+ int2vectoreq (PG_FUNCTION_ARGS )
59
+ {
60
+ int2vector * a = (int2vector * ) PG_GETARG_POINTER (0 );
61
+ int2vector * b = (int2vector * ) PG_GETARG_POINTER (1 );
62
+
63
+ if (a -> dim1 != b -> dim1 )
64
+ PG_RETURN_BOOL (false);
65
+ PG_RETURN_BOOL (memcmp (a -> values , b -> values , a -> dim1 * sizeof (int16 )) == 0 );
66
+ }
67
+
68
+
45
69
46
70
FULLEQ_FUNC ( bool , booleq , hashchar );
47
71
FULLEQ_FUNC ( bytea , byteaeq , hashvarlena );
48
72
FULLEQ_FUNC ( char , chareq , hashchar );
49
73
FULLEQ_FUNC ( name , nameeq , hashname );
50
74
FULLEQ_FUNC ( int8 , int8eq , hashint8 );
51
75
FULLEQ_FUNC ( int2 , int2eq , hashint2 );
52
- /* FULLEQ_FUNC( int2vector , int2vectoreq , hashint2vector );v10 drop
53
- * support for int2vector equality and hash operator in commit
54
- * 5c80642aa8de8393b08cd3cbf612b325cedd98dc */
55
76
FULLEQ_FUNC ( int4 , int4eq , hashint4 );
56
77
FULLEQ_FUNC ( text , texteq , hashtext );
57
78
FULLEQ_FUNC ( oid , oideq , hashoid );
@@ -72,3 +93,10 @@ FULLEQ_FUNC( timestamp , timestamp_eq , hashfloat8 );
72
93
FULLEQ_FUNC ( timestamptz , timestamp_eq , hashfloat8 );
73
94
FULLEQ_FUNC ( interval , interval_eq , interval_hash );
74
95
FULLEQ_FUNC ( timetz , timetz_eq , timetz_hash );
96
+
97
+ /*
98
+ * v10 drop * support for int2vector equality and hash operator in commit
99
+ * 5c80642aa8de8393b08cd3cbf612b325cedd98dc, but for compatibility
100
+ * we still add this operators
101
+ */
102
+ FULLEQ_FUNC ( int2vector , int2vectoreq , hashint2vector );
0 commit comments