From 55f9142f3dcc0a8a83f266ae647a835d8e12bea1 Mon Sep 17 00:00:00 2001 From: Vlad Stan Date: Fri, 10 Feb 2023 12:09:45 +0200 Subject: [PATCH] fix: query for SQLite --- crud.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crud.py b/crud.py index 87bd29c..a7d2145 100644 --- a/crud.py +++ b/crud.py @@ -120,7 +120,7 @@ async def get_event(relay_id: str, id: str) -> Optional[NostrEvent]: async def get_storage_for_public_key(relay_id: str, pubkey: str) -> int: """Returns the storage space in bytes for all the events of a public key. Deleted events are also counted""" - row = await db.fetchone("SELECT SUM(size) FROM nostrrelay.events WHERE relay_id = ? AND pubkey = ?", (relay_id, pubkey,)) + row = await db.fetchone("SELECT SUM(size) as sum FROM nostrrelay.events WHERE relay_id = ? AND pubkey = ? GROUP BY pubkey", (relay_id, pubkey,)) if not row: return 0