33SELECT create_table_with_encrypted();
44SELECT seed_encrypted_json();
55
6- SELECT e FROM encrypted WHERE e- > ' a7cea93975ed8c01f861ccb6bd082784' ::text <= ' ("{""c"": ""mBbM0#UZON2jQ3@LiWcvns2Yf6y3L;hykEh`}*fX#aF;n*=>+*o5Uarod39C7TF-SiCD-NgkG)l%Vw=l!tX>H*P<PfE$+0Szy"", ""s"": ""2517068c0d1f9d4d41d2c666211f785e"", ""ocf"": ""b0c13d4a4a9ffcb2ef853959fb2d26236337244ed86d66470d08963ed703356a1cee600a9a75a70aaefc1b4ca03b7918a7df25b7cd4ca774fd5b8616e6b9adb8""}")' ::eql_v2_encrypted;
6+
7+
8+ -- --
9+ -- -- ORE - eql_v2_encrypted <= eql_v2_encrypted
10+ -- --
11+ -- DO $$
12+ -- DECLARE
13+ -- e eql_v2_encrypted;
14+ -- ore_term jsonb;
15+ -- BEGIN
16+
17+ -- -- Record with a Numeric ORE term of 42
18+ -- e := create_encrypted_ore_json(42);
19+ -- PERFORM seed_encrypted(e);
20+
21+ -- PERFORM assert_result(
22+ -- 'eql_v2_encrypted <= eql_v2_encrypted',
23+ -- format('SELECT e FROM encrypted WHERE e <= %L::eql_v2_encrypted', e));
24+
25+ -- PERFORM assert_count(
26+ -- format('eql_v2_encrypted <= eql_v2_encrypted'),
27+ -- format('SELECT e FROM encrypted WHERE e <= %L;', e),
28+ -- 4);
29+
30+ -- e := create_encrypted_ore_json(20);
31+
32+ -- PERFORM assert_result(
33+ -- 'eql_v2_encrypted <= eql_v2_encrypted',
34+ -- format('SELECT e FROM encrypted WHERE e <= %L::eql_v2_encrypted', e));
35+
36+ -- PERFORM assert_count(
37+ -- format('eql_v2_encrypted <= eql_v2_encrypted'),
38+ -- format('SELECT e FROM encrypted WHERE e <= %L;', e),
39+ -- 2);
40+ -- END;
41+ -- $$ LANGUAGE plpgsql;
42+
43+
44+ -- --
45+ -- -- ORE - eql_v2.lte(a eql_v2_encrypted, b eql_v2_encrypted)
46+ -- --
47+ -- DO $$
48+ -- DECLARE
49+ -- e eql_v2_encrypted;
50+ -- ore_term jsonb;
51+ -- BEGIN
52+ -- -- Reset data
53+ -- PERFORM seed_encrypted_json();
54+
55+ -- -- Record with a Numeric ORE term of 42
56+ -- e := create_encrypted_ore_json(42);
57+ -- PERFORM seed_encrypted(e);
58+
59+ -- PERFORM assert_result(
60+ -- 'eql_v2.lte(a eql_v2_encrypted, b eql_v2_encrypted)',
61+ -- format('SELECT e FROM encrypted WHERE eql_v2.lte(e, %L)', e));
62+
63+ -- -- include
64+ -- PERFORM assert_count(
65+ -- 'eql_v2.lte(a eql_v2_encrypted, b eql_v2_encrypted)',
66+ -- format('SELECT e FROM encrypted WHERE eql_v2.lte(e, %L)', e),
67+ -- 4);
68+
69+ -- -- Record with a Numeric ORE term of 30
70+ -- e := create_encrypted_ore_json(30);
71+
72+ -- PERFORM assert_result(
73+ -- 'eql_v2.get(a eql_v2_encrypted, b eql_v2_encrypted)',
74+ -- format('SELECT e FROM encrypted WHERE eql_v2.lte(e, %L)', e));
75+
76+ -- PERFORM assert_count(
77+ -- 'eql_v2.get(a eql_v2_encrypted, b eql_v2_encrypted)',
78+ -- format('SELECT e FROM encrypted WHERE eql_v2.lte(e, %L)', e),
79+ -- 3);
80+ -- END;
81+ -- $$ LANGUAGE plpgsql;
82+
83+
784
885
986-- ------------------------------------------------------------------------
@@ -31,25 +108,30 @@ DECLARE
31108 -- extract the term at $.n returned as eql_v2_encrypted
32109 term := sv- > ' 2517068c0d1f9d4d41d2c666211f785e' ::text ;
33110
111+ RAISE NOTICE ' term: %' , term;
112+
34113 -- -- -- -- $.n
35114 PERFORM assert_result(
36115 format(' eql_v2_encrypted <= eql_v2_encrypted with ore_cllw_u64_8 index term' ),
37116 format(' SELECT e FROM encrypted WHERE e->' ' 2517068c0d1f9d4d41d2c666211f785e' ' ::text <= %L::eql_v2_encrypted' , term));
38117
39118 PERFORM assert_count(
40- format(' eql_v2_encrypted <= eql_v2_encrypted with ore index term' ),
119+ format(' eql_v2_encrypted <= eql_v2_encrypted with ore_cllw_u64_8 index term' ),
41120 format(' SELECT e FROM encrypted WHERE e->' ' 2517068c0d1f9d4d41d2c666211f785e' ' ::text <= %L::eql_v2_encrypted' , term),
42121 3 );
43122
44- -- -- Check the $.hello path
45- -- -- Returned encrypted does not have ore_cllw_u64_8
46- PERFORM assert_no_result(
123+ -- Check the $.hello path
124+ -- Returned encrypted does not have ore_cllw_u64_8
125+ -- Falls back to jsonb literal comparison
126+ PERFORM assert_result(
47127 format(' eql_v2_encrypted <= eql_v2_encrypted with ore_cllw_u64_8 index term' ),
48128 format(' SELECT e FROM encrypted WHERE e->' ' a7cea93975ed8c01f861ccb6bd082784' ' ::text <= %L::eql_v2_encrypted' , term));
49129
50130 END;
51131$$ LANGUAGE plpgsql;
52132
133+
134+
53135-- ------------------------------------------------------------------------
54136-- ------------------------------------------------------------------------
55137--
@@ -87,7 +169,8 @@ DECLARE
87169
88170 -- -- Check the $.n path
89171 -- -- Returned encrypted does not have ore_cllw_u64_8
90- PERFORM assert_no_result(
172+ -- Falls back to jsonb literal comparison
173+ PERFORM assert_result(
91174 format(' eql_v2_encrypted <= eql_v2_encrypted with ore_cllw_var_8 index term' ),
92175 format(' SELECT e FROM encrypted WHERE e->' ' 2517068c0d1f9d4d41d2c666211f785e' ' ::text <= %L::eql_v2_encrypted' , term));
93176
@@ -96,80 +179,4 @@ $$ LANGUAGE plpgsql;
96179
97180
98181
99- --
100- -- ORE - eql_v2_encrypted <= eql_v2_encrypted
101- --
102- DO $$
103- DECLARE
104- e eql_v2_encrypted;
105- ore_term jsonb;
106- BEGIN
107-
108- -- Record with a Numeric ORE term of 42
109- e := create_encrypted_ore_json(42 );
110- PERFORM seed_encrypted(e);
111-
112- PERFORM assert_result(
113- ' eql_v2_encrypted <= eql_v2_encrypted' ,
114- format(' SELECT e FROM encrypted WHERE e <= %L::eql_v2_encrypted' , e));
115-
116- PERFORM assert_count(
117- format(' eql_v2_encrypted <= eql_v2_encrypted' ),
118- format(' SELECT e FROM encrypted WHERE e <= %L;' , e),
119- 4 );
120-
121- e := create_encrypted_ore_json(20 );
122-
123- PERFORM assert_result(
124- ' eql_v2_encrypted <= eql_v2_encrypted' ,
125- format(' SELECT e FROM encrypted WHERE e <= %L::eql_v2_encrypted' , e));
126-
127- PERFORM assert_count(
128- format(' eql_v2_encrypted <= eql_v2_encrypted' ),
129- format(' SELECT e FROM encrypted WHERE e <= %L;' , e),
130- 2 );
131- END;
132- $$ LANGUAGE plpgsql;
133-
134-
135- --
136- -- ORE - eql_v2.gte(a eql_v2_encrypted, b eql_v2_encrypted)
137- --
138- DO $$
139- DECLARE
140- e eql_v2_encrypted;
141- ore_term jsonb;
142- BEGIN
143- -- Reset data
144- PERFORM seed_encrypted_json();
145-
146- -- Record with a Numeric ORE term of 42
147- e := create_encrypted_ore_json(42 );
148- PERFORM seed_encrypted(e);
149-
150- PERFORM assert_result(
151- ' eql_v2.lte(a eql_v2_encrypted, b eql_v2_encrypted)' ,
152- format(' SELECT e FROM encrypted WHERE eql_v2.lte(e, %L)' , e));
153-
154- -- include
155- PERFORM assert_count(
156- ' eql_v2.lte(a eql_v2_encrypted, b eql_v2_encrypted)' ,
157- format(' SELECT e FROM encrypted WHERE eql_v2.lte(e, %L)' , e),
158- 4 );
159-
160- -- Record with a Numeric ORE term of 30
161- e := create_encrypted_ore_json(30 );
162-
163- PERFORM assert_result(
164- ' eql_v2.get(a eql_v2_encrypted, b eql_v2_encrypted)' ,
165- format(' SELECT e FROM encrypted WHERE eql_v2.lte(e, %L)' , e));
166-
167- PERFORM assert_count(
168- ' eql_v2.get(a eql_v2_encrypted, b eql_v2_encrypted)' ,
169- format(' SELECT e FROM encrypted WHERE eql_v2.lte(e, %L)' , e),
170- 3 );
171- END;
172- $$ LANGUAGE plpgsql;
173-
174-
175182SELECT drop_table_with_encrypted();
0 commit comments