Skip to content

Commit 2f6c43c

Browse files
committed
fix having
1 parent bbf8c61 commit 2f6c43c

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

crates/grpc/server/src/lib.rs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,7 @@ impl DojoWorld {
253253
bind_values.push(decoded_cursor);
254254
}
255255

256-
let where_sql = if !conditions.is_empty() {
256+
let where_clause = if !conditions.is_empty() {
257257
format!("WHERE {}", conditions.join(" AND "))
258258
} else {
259259
String::new()
@@ -267,12 +267,16 @@ impl DojoWorld {
267267
group_concat({model_relation_table}.model_id) as model_ids
268268
FROM {table}
269269
JOIN {model_relation_table} ON {table}.id = {model_relation_table}.entity_id
270-
{where_sql}
270+
{where_clause}
271271
GROUP BY {table}.event_id
272-
HAVING {having_clause}
272+
{}
273273
ORDER BY {table}.event_id {order_direction}
274274
LIMIT ?
275-
"
275+
", if !having_clause.is_empty() {
276+
format!("HAVING {}", having_clause)
277+
} else {
278+
String::new()
279+
}
276280
);
277281

278282
let mut query = sqlx::query_as(&query_str);

0 commit comments

Comments
 (0)