PSQL error if adding user to a Team

Hi all,

Version: Grafana 8.4.5
Postgres: 9.6
OS: Debian 10 buster

I cant say exactly, but since Grafana 8.4.*, adding a user (ldap source) to a team (manual process because no Enterprise license) seems to be broken with PostgreSQL.

According to the logs:

grafana.log

msg="Failed to add Member to Team" error="failed setting permissions for user 131 in team 1: pq: could not determine data type of parameter $1

postgres.log

2022-04-08 11:36:39.483 UTC [42618] grafana@grafana ERROR:  could not determine data type of parameter $1
2022-04-08 11:36:39.483 UTC [42618] grafana@grafana STATEMENT:
                SELECT
                        p.*,
                        $1 AS resource_id,
                        ur.user_id AS user_id,
                        u.login AS user_login,
                        u.email AS user_email,
                        tr.team_id AS team_id,
                        t.name AS team,
                        t.email AS team_email,
                        r.name as role_name
                FROM permission p
                        LEFT JOIN role r ON p.role_id = r.id
                        LEFT JOIN team_role tr ON r.id = tr.role_id
                        LEFT JOIN team t ON tr.team_id = t.id
                        LEFT JOIN user_role ur ON r.id = ur.role_id
                        LEFT JOIN "user" u ON ur.user_id = u.id
                WHERE p.id = $2

Another interesting line during startup of grafana:

Apr  8 10:59:15 xxxxxxxxx grafana-server[204450]: logger=migrator t=2022-04-08T10:59:15.75+0000 lvl=info msg="migrations completed" performed=0 skipped=381 duration=778.506µs

Looks like database schema migrations have been skipped during upgrades. Is there a cmd / solution for triggering them manually (if that fixes the issue)?

Many thanks in advance & br
Oliver

1 Like

I got the same issue with grafana 8.4.4.

Thanks for opening up this issue. Our developers are working on a fix for this here

1 Like