Re: Getting table name/tuple from OID - Mailing list pgsql-hackers

From Marek Lewczuk
Subject Re: Getting table name/tuple from OID
Date
Msg-id 4374E159.7020200@lewczuk.com
Whole thread Raw
In response to Re: Getting table name/tuple from OID  (huaxin zhang <uwcssa@gmail.com>)
Responses Re: Getting table name/tuple from OID  (uwcssa <uwcssa@gmail.com>)
List pgsql-hackers
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;



pgsql-hackers by date:

Previous
From: Peter Eisentraut
Date:
Subject: Re: someone working to add merge?
Next
From: Tom Lane
Date:
Subject: Re: someone working to add merge?