pg_current_wal_lsn()

A function returning the current WAL write location

pg_current_wal_lsn() is a system function returning the current write-ahead log write location.

pg_current_wal_lsn() was added in PostgreSQL 8.2 as pg_current_xlog_location().

Usage

pg_current_wal_lsn() → pg_lsn

Change history

Examples

Basic usage example for pg_current_wal_lsn():

postgres=# SELECT pg_current_wal_lsn();
 pg_current_wal_lsn 
--------------------
 7/B466C0F0
(1 row)

pg_current_wal_lsn() cannot be executed on a standby:

postgres=# SELECT pg_current_wal_lsn();
ERROR:  recovery is in progress
HINT:  WAL control functions cannot be executed during recovery.

Categories

System function, WAL

See also

pg_current_wal_flush_lsn(), pg_current_wal_insert_lsn()