pg_identify_object()

返回识别指定对象的数据的函数

pg_identify_object() 是一个系统函数,返回可唯一识别指定对象的机器可读数据。

pg_identify_object()PostgreSQL 9.3 中添加。

用法

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

更改历史记录

示例

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)

通过 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)

分类

系统目录系统函数

另请参阅

pg_identify_object_as_address()pg_get_object_address()

反馈

提交任何关于 "pg_identify_object()" 的评论、建议或更正 此处