Fix index tail leak (#1159)

This commit is contained in:
Ellie Huxtable 2023-08-09 23:47:31 +01:00 committed by GitHub
parent 5fd49d4da2
commit 925bf0efaa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -437,7 +437,7 @@ impl Database for Postgres {
} }
async fn tail_records(&self, user: &User) -> DbResult<RecordIndex> { async fn tail_records(&self, user: &User) -> DbResult<RecordIndex> {
const TAIL_RECORDS_SQL: &str = "select host, tag, client_id from records rp where (select count(1) from records where parent=rp.client_id and user_id = $1) = 0;"; const TAIL_RECORDS_SQL: &str = "select host, tag, client_id from records rp where (select count(1) from records where parent=rp.client_id and user_id = $1) = 0 and user_id = $1;";
let res = sqlx::query_as(TAIL_RECORDS_SQL) let res = sqlx::query_as(TAIL_RECORDS_SQL)
.bind(user.id) .bind(user.id)