Postgres's lateral joins allow for quite the good eDSL
Summary
The article introduces PostgreSQL lateral joins as a means to build expressive, composable SQL via an embedded DSL (eDSL). It compares traditional query-building approaches (manual joins, ORMs) with lateral joins, and presents Rel8 (Haskell) and rust-rel8 (Rust) as examples of type-safe, composable SQL DSLs. It provides code sketches showing how to implement such DSLs, manage lifetimes in Rust, and perform advanced patterns like aggregations and optional joins.