MCPcopy Create free account
hub / github.com/erans/pgsqlite / test_simple_join_aggregate

Function test_simple_join_aggregate

tests/subquery_cte_test.rs:98–112  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

96
97#[test]
98fn test_simple_join_aggregate() {
99 let conn = setup_test_db();
100
101 // First test simple aggregate with alias
102 let sql = "SELECT AVG(o.total) FROM orders o";
103 let result = rewrite_query(&conn, sql).unwrap();
104 println!("Simple alias aggregate rewritten to: {result}");
105 assert!(result.contains("decimal_from_text"));
106
107 // Then test join aggregate
108 let sql2 = "SELECT c.name, AVG(o.total) FROM customers c JOIN orders o ON c.id = o.customer_id GROUP BY c.name";
109 let result2 = rewrite_query(&conn, sql2).unwrap();
110 println!("Join aggregate rewritten to: {result2}");
111 assert!(result2.contains("decimal_from_text"));
112}
113
114#[test]
115fn test_simple_subquery_in_select() {

Callers

nothing calls this directly

Calls 2

setup_test_dbFunction · 0.70
rewrite_queryFunction · 0.70

Tested by

no test coverage detected