mirror of
https://github.com/zitadel/zitadel.git
synced 2025-12-27 00:06:28 +00:00
# Which Problems Are Solved When listing / searching users, each user got multiplied by the amount of metadata entries they have, towards the `total_results` count. In PostgreSQL the `COUNT(*) OVER()` window function does not support `DISTINCT`. Even tho the query did a distinct select, the count would still include duplicates. # How the Problems Are Solved Wrap the original query in a sub-select, so that the `DISTINCT` gets handled before the count window function is executed in the outer function. Filters, permission and solting is applied to the inner query. Offset, limit and count are applied to the outer query. # Additional Changes - none # Additional Context - Closes https://github.com/zitadel/zitadel/issues/10825 - Backport to 4v