diff --git a/lib/src/sql/group.rs b/lib/src/sql/group.rs index 2f7a07e2..7857d736 100644 --- a/lib/src/sql/group.rs +++ b/lib/src/sql/group.rs @@ -32,7 +32,11 @@ impl IntoIterator for Groups { impl Display for Groups { fn fmt(&self, f: &mut Formatter) -> fmt::Result { - write!(f, "GROUP BY {}", Fmt::comma_separated(&self.0)) + if self.0.is_empty() { + write!(f, "GROUP ALL") + } else { + write!(f, "GROUP BY {}", Fmt::comma_separated(&self.0)) + } } } @@ -114,4 +118,12 @@ mod tests { ); assert_eq!("GROUP BY field, other.field", format!("{}", out)); } + + #[test] + fn group_statement_all() { + let sql = "GROUP ALL"; + let out = group(sql).unwrap().1; + assert_eq!(out, Groups(Vec::new())); + assert_eq!(sql, out.to_string()); + } }