A function providing information about files in replication slot directories

pg_ls_replslotdir() is a system function providing information about files in a specific replication slot directory.

pg_ls_replslotdir() was added in PostgreSQL 15.


pg_ls_replslotdir ( slot_name text ) 
        → setof record ( name text, size bigint, modification timestamp with time zone )

pg_ls_replslotdir() returns a list of all normal files in the replication slot directory specified by the slot_name parameter.

Note that the rows are not returned in any particular order, so it may be useful to add an explicit sort criteria.

Change history


Basic usage example for pg_ls_replslotdir():

postgres=# SELECT * FROM pg_ls_replslotdir('node2');
 name  | size |      modification      
 state |  200 | 2021-11-24 06:13:08+01
(1 row)

Attempting to query a non-existent replication slot:

postgres=# SELECT * FROM pg_ls_replslotdir('node1');
ERROR:  replication slot "node1" does not exist


Data directory, File access and manipulation, Replication, Replication slots, System function

See also