Skip to content

function pg_current_wal_lsn() not exists on 9.5.x #495

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
csabka opened this issue Mar 3, 2021 · 9 comments · Fixed by #537
Closed

function pg_current_wal_lsn() not exists on 9.5.x #495

csabka opened this issue Mar 3, 2021 · 9 comments · Fixed by #537

Comments

@csabka
Copy link

csabka commented Mar 3, 2021

bug in new feature in 0.9.0
pg_replication_slots pq: function pg_current_wal_lsn() does not exist" source="postgres_exporter.go:1503"

pg_current_wal_lsn() function only exists from 10 version.

There should be a bool to switch of this new feature

@roidelapluie
Copy link

thanks for your report. we could simply only query it in psql 10+

@nnz1024
Copy link

nnz1024 commented Mar 23, 2021

Hi @roidelapluie !
Still got this problem. It appears in

SELECT slot_name, database, active, pg_wal_lsn_diff(pg_current_wal_lsn(), restart_lsn)

This query is marked as >=9.4.0 and contains pg_current_wal_lsn() which introduced only in Postgres 10.

@nicholasklem
Copy link

Any progress on reviewing this PR? 👍

@halvaborsch
Copy link
Contributor

Think we can make it even better.

@WalkerWalker
Copy link

WalkerWalker commented Mar 27, 2023

this problem still exists in version 0.12.0, postgres 9.6

log from exporter

ts=2023-03-27T15:32:00.188Z caller=collector.go:194 level=error msg="collector failed" name=replication_slot duration_seconds=0.011199623 err="pq: function pg_current_wal_lsn() does not exist"

log from postgres

postgres_1                        | ERROR:  function pg_current_wal_lsn() does not exist at character 25
postgres_1                        | HINT:  No function matches the given name and argument types. You might need to add explicit type casts.
postgres_1                        | STATEMENT:  SELECT
postgres_1                        | 				slot_name,
postgres_1                        | 				pg_current_wal_lsn() - '0/0' AS current_wal_lsn,
postgres_1                        | 				coalesce(confirmed_flush_lsn, '0/0') - '0/0',
postgres_1                        | 				active
postgres_1                        | 			FROM
postgres_1                        | 				pg_replication_slots;

in version 0.10.0, the problem does not appear.

@rEVOLution-BlackMamba
Copy link

this problem still exists in version 0.12.0, postgres 9.6

log from exporter

ts=2023-03-27T15:32:00.188Z caller=collector.go:194 level=error msg="collector failed" name=replication_slot duration_seconds=0.011199623 err="pq: function pg_current_wal_lsn() does not exist"

log from postgres

postgres_1                        | ERROR:  function pg_current_wal_lsn() does not exist at character 25
postgres_1                        | HINT:  No function matches the given name and argument types. You might need to add explicit type casts.
postgres_1                        | STATEMENT:  SELECT
postgres_1                        | 				slot_name,
postgres_1                        | 				pg_current_wal_lsn() - '0/0' AS current_wal_lsn,
postgres_1                        | 				coalesce(confirmed_flush_lsn, '0/0') - '0/0',
postgres_1                        | 				active
postgres_1                        | 			FROM
postgres_1                        | 				pg_replication_slots;

in version 0.10.0, the problem does not appear.

Same problem over here. Same version of postgres and postgres-exporter.

@halvaborsch
Copy link
Contributor

you're mistaken, this is a new code that appeared in version 0.12.0

@halvaborsch
Copy link
Contributor

@sysadmind
Copy link
Contributor

It would appear that support for postgres < 10 was missed in that PR. Postgres 9 is not a version that we test against in our CI system. It's end of support so we don't go out of our way to test on it, but we don't intentionally break compatibility when we can avoid it. I think we could add that second query back to support < 10, but it would require some work to architect a maintainable system to handle different queries for different server versions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

8 participants