1
+ \set ON_ERROR_STOP on
2
+
3
+ SELECT create_table_with_encrypted();
4
+ SELECT seed_encrypted_json();
5
+
6
+
7
+ -- ========================================================================
8
+
9
+
10
+ -- ------------------------------------------------------------------------
11
+ -- ------------------------------------------------------------------------
12
+ --
13
+ -- ore_cllw_u64_8 less than or equal to <=
14
+ --
15
+ -- Test data is in form '{"hello": "{one | two | three}", "n": {10 | 20 | 30} }'
16
+ --
17
+ -- Paths
18
+ -- $ -> bca213de9ccce676fa849ff9c4807963
19
+ -- $.hello -> a7cea93975ed8c01f861ccb6bd082784
20
+ -- $.n -> 2517068c0d1f9d4d41d2c666211f785e
21
+ --
22
+ --
23
+ DO $$
24
+ DECLARE
25
+ sv eql_v2_encrypted;
26
+ term eql_v2_encrypted;
27
+ BEGIN
28
+
29
+ -- This extracts the data associated with the field from the test eql_v2_encrypted
30
+ -- json n: 10
31
+ sv := get_numeric_ste_vec_20()::eql_v2_encrypted;
32
+ -- extract the term at $.n returned as eql_v2_encrypted
33
+ term := sv- > ' 2517068c0d1f9d4d41d2c666211f785e' ::text ;
34
+
35
+ -- -- -- -- $.n
36
+ PERFORM assert_result(
37
+ format(' eql_v2_encrypted <= eql_v2_encrypted with ore_cllw_u64_8 index term' ),
38
+ format(' SELECT e FROM encrypted WHERE (e->' ' 2517068c0d1f9d4d41d2c666211f785e' ' ::text) <= %L::eql_v2_encrypted' , term));
39
+
40
+ PERFORM assert_count(
41
+ format(' eql_v2_encrypted <= eql_v2_encrypted with ore index term' ),
42
+ format(' SELECT e FROM encrypted WHERE e->' ' 2517068c0d1f9d4d41d2c666211f785e' ' ::text <= %L::eql_v2_encrypted' , term),
43
+ 2 );
44
+
45
+ -- Check the $.hello path
46
+ -- Returned encrypted does not have ore_cllw_u64_8
47
+ -- Falls back to jsonb literal comparison
48
+ PERFORM assert_no_result(
49
+ format(' eql_v2_encrypted <= eql_v2_encrypted with ore index term' ),
50
+ format(' SELECT e FROM encrypted WHERE e->' ' a7cea93975ed8c01f861ccb6bd082784' ' ::text <= %L::eql_v2_encrypted' , term));
51
+
52
+ END;
53
+ $$ LANGUAGE plpgsql;
54
+
55
+
56
+
57
+ SELECT drop_table_with_encrypted();
0 commit comments