Skip to content

Commit

Permalink
fix(webserver): conditional query should be applied in source, before…
Browse files Browse the repository at this point in the history
… limit count
  • Loading branch information
wsxiaoys committed Apr 28, 2024
1 parent fe3b270 commit afe9d5b
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions ee/tabby-db/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,10 @@ fn make_pagination_query_with_condition(
.select(&field_names.join(", "))
.order_by("id ASC");

if let Some(condition) = condition {
source = source.where_and(&condition)
}

if backwards {
source = source.order_by("id DESC");
if let Some(skip_id) = skip_id {
Expand All @@ -89,10 +93,6 @@ fn make_pagination_query_with_condition(
}

select = select.from(&format!("({source})"));
if let Some(condition) = condition {
select = select.where_and(&condition)
}

select.as_string()
}

Expand Down

0 comments on commit afe9d5b

Please sign in to comment.