pg_identify_object()

A function returning data identifying the specified object

pg_identify_object() is a system function returning machine-readable data uniquely identifying the specified object.

pg_identify_object() was added in PostgreSQL 9.3.

Usage

pg_identify_object ( classid oid, objid oid, objsubid integer )
        → record ( type text, schema text, name text, identity text )

Change history

Examples

Basic usage example for pg_identify_object():

postgres=# CREATE FUNCTION bar (int) RETURNS int LANGUAGE SQL AS 'SELECT 1';
CREATE FUNCTION

postgres=# SELECT * FROM pg_get_object_address('function', '{bar}', '{int}');
 classid | objid | objsubid 
---------+-------+----------
    1255 | 16511 |        0
(1 row)

postgres=# SELECT * FROM pg_identify_object ( 1255,  16511, 0);
   type   | schema | name |      identity       
----------+--------+------+---------------------
 function | public |      | public.bar(integer)
(1 row)

Generating identification via pg_get_object_address():

postgres=# SELECT (pg_identify_object(addr.classid, addr.objid, addr.objsubid)).*
             FROM pg_get_object_address('table', '{foo}','{}') addr;
 type  | schema | name |  identity  
-------+--------+------+------------
 table | public | foo  | public.foo
(1 row)

postgres=# SELECT (pg_identify_object(addr.classid, addr.objid, addr.objsubid)).*
             FROM pg_get_object_address('table column', '{foo,id}','{}') addr;
     type     | schema | name |   identity    
--------------+--------+------+---------------
 table column | public | foo  | public.foo.id
(1 row)

Categories

System catalogue, System function

See also

pg_identify_object_as_address(), pg_get_object_address()