You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
IF eql_v2.has_ore_block_u64_8_256(a) ANDeql_v2.has_ore_block_u64_8_256(b) THEN
46
+
RETURN eql_v2.compare_ore_block_u64_8_256(a, b);
47
+
END IF;
48
+
49
+
-- Fallback to hmac if BOTH parameters have hmac index
50
+
IF eql_v2.has_hmac_256(a) ANDeql_v2.has_hmac_256(b) THEN
51
+
RETURN eql_v2.compare_hmac(a, b);
52
+
END IF;
53
+
54
+
-- Fallback to ORE if one of the parameters has ore index
55
+
IF eql_v2.has_ore_block_u64_8_256(a) OReql_v2.has_ore_block_u64_8_256(b) THEN
56
+
RETURN eql_v2.compare_ore_block_u64_8_256(a, b);
57
+
END IF;
58
+
59
+
-- Fallback to hmac if ONE of the parameters has hmac index
60
+
IF eql_v2.has_hmac_256(a) OReql_v2.has_hmac_256(b) THEN
61
+
RETURN eql_v2.compare_hmac(a, b);
62
+
END IF;
63
+
64
+
RAISE 'Expected an hmac_256 (hm) or ore_block_u64_8_256 (ob) value in json: %', val;
65
+
END;
66
+
$$ LANGUAGE plpgsql;
67
+
68
+
--------------------
69
+
70
+
CREATEFUNCTIONeql_v2.compare_ore_block_u64_8_256(a eql_v2_encrypted, b eql_v2_encrypted)
71
+
RETURNS integer
72
+
IMMUTABLE STRICT PARALLEL SAFE
16
73
AS $$
17
74
DECLARE
18
75
a_ore eql_v2.ore_block_u64_8_256;
@@ -38,20 +95,9 @@ AS $$
38
95
END;
39
96
$$ LANGUAGE plpgsql;
40
97
41
-
CREATEOPERATORFAMILYeql_v2.encrypted_operator USING btree;
42
-
43
-
CREATEOPERATOR CLASSeql_v2.encrypted_operator DEFAULT FOR TYPE eql_v2_encrypted USING btree FAMILY eql_v2.encrypted_operatorAS
44
-
OPERATOR 1<,
45
-
OPERATOR 2<=,
46
-
OPERATOR 3=,
47
-
OPERATOR 4>=,
48
-
OPERATOR 5>,
49
-
FUNCTION 1eql_v2.compare(a eql_v2_encrypted, b eql_v2_encrypted);
50
-
51
98
52
99
--------------------
53
100
54
-
55
101
CREATEFUNCTIONeql_v2.compare_hmac(a eql_v2_encrypted, b eql_v2_encrypted)
56
102
RETURNS integer
57
103
IMMUTABLE STRICT PARALLEL SAFE
@@ -64,6 +110,18 @@ AS $$
64
110
a_hmac =eql_v2.hmac_256(a);
65
111
b_hmac =eql_v2.hmac_256(b);
66
112
113
+
IF a_hmac IS NULLAND b_hmac IS NULL THEN
114
+
RETURN 0;
115
+
END IF;
116
+
117
+
IF a_hmac IS NULL THEN
118
+
RETURN -1;
119
+
END IF;
120
+
121
+
IF b_hmac IS NULL THEN
122
+
RETURN 1;
123
+
END IF;
124
+
67
125
IF a_hmac = b_hmac THEN
68
126
RETURN 0;
69
127
END IF;
@@ -80,13 +138,40 @@ AS $$
80
138
$$ LANGUAGE plpgsql;
81
139
82
140
83
-
CREATEOPERATORFAMILYeql_v2.encrypted_hmac_256_operator USING btree;
141
+
--------------------
142
+
143
+
CREATEOPERATORFAMILYeql_v2.encrypted_operator USING btree;
84
144
85
-
CREATEOPERATOR CLASSeql_v2.encrypted_hmac_256_operator FOR TYPE eql_v2_encrypted USING btree FAMILY eql_v2.encrypted_hmac_256_operatorAS
145
+
CREATEOPERATOR CLASSeql_v2.encrypted_operator DEFAULT FOR TYPE eql_v2_encrypted USING btree FAMILY eql_v2.encrypted_operatorAS
86
146
OPERATOR 1<,
87
147
OPERATOR 2<=,
88
148
OPERATOR 3=,
89
149
OPERATOR 4>=,
90
150
OPERATOR 5>,
91
-
FUNCTION 1eql_v2.compare_hmac(a eql_v2_encrypted, b eql_v2_encrypted);
151
+
FUNCTION 1eql_v2.compare(a eql_v2_encrypted, b eql_v2_encrypted);
152
+
153
+
154
+
--------------------
155
+
156
+
-- CREATE OPERATOR FAMILY eql_v2.encrypted_operator_ore_block_u64_8_256 USING btree;
157
+
158
+
-- CREATE OPERATOR CLASS eql_v2.encrypted_operator_ore_block_u64_8_256 FOR TYPE eql_v2_encrypted USING btree FAMILY eql_v2.encrypted_operator_ore_block_u64_8_256 AS
159
+
-- OPERATOR 1 <,
160
+
-- OPERATOR 2 <=,
161
+
-- OPERATOR 3 =,
162
+
-- OPERATOR 4 >=,
163
+
-- OPERATOR 5 >,
164
+
-- FUNCTION 1 eql_v2.compare_ore_block_u64_8_256(a eql_v2_encrypted, b eql_v2_encrypted);
165
+
166
+
-- --------------------
167
+
168
+
-- CREATE OPERATOR FAMILY eql_v2.encrypted_hmac_256_operator USING btree;
169
+
170
+
-- CREATE OPERATOR CLASS eql_v2.encrypted_hmac_256_operator FOR TYPE eql_v2_encrypted USING btree FAMILY eql_v2.encrypted_hmac_256_operator AS
171
+
-- OPERATOR 1 <,
172
+
-- OPERATOR 2 <=,
173
+
-- OPERATOR 3 =,
174
+
-- OPERATOR 4 >=,
175
+
-- OPERATOR 5 >,
176
+
-- FUNCTION 1 eql_v2.compare_hmac(a eql_v2_encrypted, b eql_v2_encrypted);
0 commit comments