I'm trying to find a way to get the last pg wal (stop wal location) which was stored in the backup made by pg_basebackup. Is it there any function in pg which could give me the wal in pg_lsn format?
In old-level-api there was pg_start_backup, pg_stop_backup functions which return the start and stop wal location.
Thank you in advance
You can still use pg_start_backup
and pg_stop_backup
.
The answer to your question depends on the reason why you need that. If you need to know the earliest LSN to which you can recover, you could simply connect to PostgreSQL after pg_basebackup
is done and run
SELECT pg_current_wal_lsn();
That will give you a point slightly later than the minimum, but it would be a safe value.