Postgresql – RDS Postgres – pg_stat_statements is missing queryid column

amazon-rdspostgresql

I upgraded my RDS postgres instances from 9.3 -> 9.4 -> 9.5 several months ago. When installing the pganalyzer-collector tool, I got a funny error that the "queryid" column does not exist in the pg_stat_statements table. It looks like that column was added in version 9.4. I'm now running 9.5 and expect to see this column in that table.

How could this have happened? And how can I make this column appear in the pg_stat_statements table?

Best Answer

Update: Lukas from pganalyze helped me. How nice! The answer was as follows:

DROP FUNCTION pganalyze.get_stat_statements();
ALTER EXTENSION pg_stat_statements UPDATE;
CREATE OR REPLACE FUNCTION pganalyze.get_stat_statements() RETURNS SETOF pg_stat_statements AS
$$
/* pganalyze-collector */ SELECT * FROM public.pg_stat_statements;
$$ LANGUAGE sql VOLATILE SECURITY DEFINER;