File tree Expand file tree Collapse file tree 1 file changed +47
-0
lines changed
Expand file tree Collapse file tree 1 file changed +47
-0
lines changed Original file line number Diff line number Diff line change @@ -25,4 +25,51 @@ DECLARE
2525 format(' SELECT id FROM ore WHERE e < %L ORDER BY eql_v2.order_by(e) ASC LIMIT 1' , ore_term),
2626 ' 1' );
2727 END;
28+ $$ LANGUAGE plpgsql;
29+
30+
31+ --
32+ -- ORE - ORDER BY without function
33+ --
34+ DO $$
35+ DECLARE
36+ e eql_v2_encrypted;
37+ ore_term eql_v2_encrypted;
38+ BEGIN
39+ -- Pull a record from the ore table with value of "42"
40+ SELECT ore .e FROM ore WHERE id = 42 INTO ore_term;
41+
42+ -- lt
43+ PERFORM assert_count(
44+ ' ORDER BY eql_v2.order_by(e) DESC' ,
45+ format(' SELECT id FROM ore WHERE e < %L ORDER BY e DESC' , ore_term),
46+ 41 );
47+
48+ PERFORM assert_result(
49+ ' ORDER BY e DESC returns correct record' ,
50+ format(' SELECT id FROM ore WHERE e < %L ORDER BY e DESC LIMIT 1' , ore_term),
51+ ' 41' );
52+
53+ PERFORM assert_result(
54+ ' ORDER BY e ASC' ,
55+ format(' SELECT id FROM ore WHERE e < %L ORDER BY e ASC LIMIT 1' , ore_term),
56+ ' 1' );
57+
58+ -- gt
59+ PERFORM assert_count(
60+ ' ORDER BY eql_v2.order_by(e) DESC' ,
61+ format(' SELECT id FROM ore WHERE e > %L ORDER BY e ASC' , ore_term),
62+ 57 );
63+
64+ PERFORM assert_result(
65+ ' ORDER BY e DESC returns correct record' ,
66+ format(' SELECT id FROM ore WHERE e > %L ORDER BY e DESC LIMIT 1' , ore_term),
67+ ' 99' );
68+
69+ PERFORM assert_result(
70+ ' ORDER BY e ASC' ,
71+ format(' SELECT id FROM ore WHERE e > %L ORDER BY e ASC LIMIT 1' , ore_term),
72+ ' 43' );
73+
74+ END;
2875$$ LANGUAGE plpgsql;
You can’t perform that action at this time.
0 commit comments