huaxin zhang napisał(a):
> Hi all,
>
> I am interested in the answer as well -- how to get a table name (or
> an operator name)
> from an OID. the parser must know how to do this, but the segment
> of code is hard
> to locate.
>
CREATE OR REPLACE FUNCTION gettablename(__oid oid)
RETURNS "varchar" AS
$BODY$
SELECT (_sna.nspname || '.' || _tna.relname) AS tableQualifiedName FROM
pg_class _tna, pg_namespace _sna WHERE _tna.oid = $1 AND _sna.oid =
_tna.relnamespace;
$BODY$
LANGUAGE 'sql' IMMUTABLE;
ALTER FUNCTION gettablename(__oid oid) OWNER TO root;