zalando / pg_view

Get a detailed, real-time view of your PostgreSQL database and system metrics
https://pypi.python.org/pypi/pg-view
Other
494 stars 49 forks source link

pg_is_in_recovery() does not exist #97

Closed dutran123 closed 6 years ago

dutran123 commented 6 years ago

I am using Postgres 8.4 and get this error when running pg_view:

Traceback (most recent call last): File "./pg_view.py", line 3517, in main pg = PgstatCollector(cl['pgcon'], cl['reconnect'], cl['pid'], cl['name'], cl['ver'], options.pid) File "./pg_view.py", line 922, in init self.recovery_status = self._get_recovery_status() File "./pg_view.py", line 1314, in _get_recovery_status cur.execute("select case when pg_is_in_recovery() then 'standby' else 'master' end as role") File "/usr/lib64/python2.6/site-packages/psycopg2/extras.py", line 207, in execute return _cursor.execute(self, query, vars, async) ProgrammingError: function pg_is_in_recovery() does not exist LINE 1: select case when pg_is_in_recovery() then 'standby' else 'ma... ^ HINT: No function matches the given name and argument types. You might need to add explicit type casts.

alexeyklyukin commented 6 years ago

Well, it doesn't exist, since anything before 9.0 does not support running queries on the nodes other than primary ones aka hot standby. 8.4 is EOL for 3,5 years (https://www.postgresql.org/support/versioning/), it makes more sense to spend time on upgrading ASAP from it rather than on supporting it.

If you still, for some wrong reason, insist on running 8.4, you can change your local pg_view, removing pg_is_in_recovery call altogether and replacing it with a constant 'master'.