Skip to content

Commit

Permalink
Merge pull request #1795 from Scille/fix-postgresql-organization-stat…
Browse files Browse the repository at this point in the history
…s-query

Fix postgresql query for organization stats
  • Loading branch information
touilleMan authored Jul 27, 2021
2 parents 58f0abe + 1e7fb93 commit 54133d2
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
Empty file added newsfragments/1795.empty.rst
Empty file.
6 changes: 4 additions & 2 deletions parsec/backend/postgresql/organization.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 54133d2

Please sign in to comment.