aggregate data fix
This commit is contained in:
Generated
+1
-1
@@ -2581,7 +2581,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "rustpad"
|
name = "rustpad"
|
||||||
version = "0.1.15"
|
version = "0.1.16"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"argon2",
|
"argon2",
|
||||||
"aws-config",
|
"aws-config",
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "rustpad"
|
name = "rustpad"
|
||||||
version = "0.1.15"
|
version = "0.1.16"
|
||||||
edition = "2024"
|
edition = "2024"
|
||||||
rust-version = "1.94"
|
rust-version = "1.94"
|
||||||
description = "Collaborative Markdown notepad built with Axum, WebSockets and SQLite, PostgreSQL and MySQL"
|
description = "Collaborative Markdown notepad built with Axum, WebSockets and SQLite, PostgreSQL and MySQL"
|
||||||
|
|||||||
+5
-3
@@ -181,11 +181,13 @@ pub async fn list_note_stats(
|
|||||||
DatabaseKind::Postgres => "$1",
|
DatabaseKind::Postgres => "$1",
|
||||||
DatabaseKind::Sqlite | DatabaseKind::MySql => "?",
|
DatabaseKind::Sqlite | DatabaseKind::MySql => "?",
|
||||||
};
|
};
|
||||||
// PostgreSQL promotes SUM(BIGINT) to NUMERIC. sqlx::Any cannot decode the
|
// PostgreSQL and MySQL promote SUM(BIGINT) to database-specific decimal
|
||||||
// database-specific NUMERIC type, so normalize the aggregate to BIGINT.
|
// types. sqlx::Any cannot decode those types, so normalize the aggregate
|
||||||
|
// to a signed 64-bit integer before reading it.
|
||||||
let file_size_sum = match pool.kind() {
|
let file_size_sum = match pool.kind() {
|
||||||
DatabaseKind::Postgres => "COALESCE(SUM(f.size_bytes), 0)::BIGINT",
|
DatabaseKind::Postgres => "COALESCE(SUM(f.size_bytes), 0)::BIGINT",
|
||||||
DatabaseKind::Sqlite | DatabaseKind::MySql => "COALESCE(SUM(f.size_bytes), 0)",
|
DatabaseKind::MySql => "CAST(COALESCE(SUM(f.size_bytes), 0) AS SIGNED)",
|
||||||
|
DatabaseKind::Sqlite => "COALESCE(SUM(f.size_bytes), 0)",
|
||||||
};
|
};
|
||||||
let query = format!(
|
let query = format!(
|
||||||
"SELECT n.id AS note_id, \
|
"SELECT n.id AS note_id, \
|
||||||
|
|||||||
Reference in New Issue
Block a user