pg_stat_get_backend_dbid()

A function reporting a backend's database OID

pg_stat_get_backend_dbid() is a system function reporting the specified backend's database OID.

pg_stat_get_backend_dbid() was added in PostgreSQL 7.2.

Usage

pg_stat_get_backend_dbid ( integer ) → oid

The backend is specified by a backend ID number reported by pg_stat_get_backend_idset(); see below for an execution example.

The value returned by pg_stat_get_backend_dbid() corresponds to the column datid in pg_stat_activity.

The following related functions are also available:

Change history

Examples

Basic usage example for pg_stat_get_backend_dbid():

postgres=# SELECT pg_stat_get_backend_pid(s.backendid) AS pid,
                  pg_stat_get_backend_dbid(s.backendid) AS datid
             FROM (SELECT pg_stat_get_backend_idset() AS backendid) AS s;
   pid   | datid 
---------+-------
 1451980 |     0
 1451982 |     0
 2072322 | 16403
 1764534 | 16403
 1451978 |     0
 1451977 |     0
 1451979 |     0
(7 rows)

Categories

System function