From 62b46745fd963f6cb76679b67f55241c2ea04580 Mon Sep 17 00:00:00 2001 From: Emmanuel Leblond Date: Mon, 26 Jul 2021 21:22:33 +0200 Subject: [PATCH 1/2] Fix postgresql query for organization stats --- parsec/backend/postgresql/organization.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/parsec/backend/postgresql/organization.py b/parsec/backend/postgresql/organization.py index 8d5d0442e46..ab17fb9ea88 100644 --- a/parsec/backend/postgresql/organization.py +++ b/parsec/backend/postgresql/organization.py @@ -61,16 +61,18 @@ """ ) +# Note the `profile::text` casting here, this is a limitation of asyncpg which doesn't support +# enum within an anonymous record (see https://github.com/MagicStack/asyncpg/issues/360) _q_get_stats = Q( f""" SELECT ( SELECT ARRAY( - SELECT (revoked_on, profile) + SELECT (revoked_on, profile::text) FROM user_ WHERE organization = { q_organization_internal_id("$organization_id") } ) - )users, + ) users, ( SELECT COUNT(*) FROM realm From 1e7fb934e73f42e7b559a9ed081426791495a619 Mon Sep 17 00:00:00 2001 From: Emmanuel Leblond Date: Mon, 26 Jul 2021 21:24:55 +0200 Subject: [PATCH 2/2] Add newsfragment for #1795 --- newsfragments/1795.empty.rst | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 newsfragments/1795.empty.rst diff --git a/newsfragments/1795.empty.rst b/newsfragments/1795.empty.rst new file mode 100644 index 00000000000..e69de29bb2d