From 9c865cbb31d8b63bce7de296f44c46d4b7a570b0 Mon Sep 17 00:00:00 2001 From: Billy Chan Date: Fri, 6 Aug 2021 10:48:37 +0800 Subject: [PATCH] Try to fix count() --- src/executor/paginator.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/executor/paginator.rs b/src/executor/paginator.rs index a5aa3445..7a7eadb3 100644 --- a/src/executor/paginator.rs +++ b/src/executor/paginator.rs @@ -63,7 +63,11 @@ where Some(res) => res, None => return Ok(0), }; - let num_items = result.try_get::("", "num_items")? as usize; + let num_items = match self.db { + #[cfg(feature = "sqlx-postgres")] + DatabaseConnection::SqlxPostgresPoolConnection(_) => result.try_get::("", "num_items")? as usize, + _ => result.try_get::("", "num_items")? as usize + }; Ok(num_items) }