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

Function test_correlated_subquery

tests/subquery_cte_test.rs:290–303  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

288
289#[test]
290fn test_correlated_subquery() {
291 let conn = setup_test_db();
292
293 let sql = "SELECT c.name, c.credit_limit,
294 (SELECT MAX(o.total)
295 FROM orders o
296 WHERE o.customer_id = c.id AND o.total < c.credit_limit) as max_order
297 FROM customers c";
298 let result = rewrite_query(&conn, sql).unwrap();
299
300 println!("Correlated subquery rewritten to: {result}");
301 assert!(result.contains("decimal_lt"));
302 assert!(result.contains("MAX"));
303}
304
305#[test]
306fn test_exists_subquery() {

Callers

nothing calls this directly

Calls 2

setup_test_dbFunction · 0.70
rewrite_queryFunction · 0.70

Tested by

no test coverage detected