Re: Getting table name/tuple from OID

From: Marek Lewczuk <newsy(at)lewczuk(dot)com>
To: huaxin zhang <uwcssa(at)gmail(dot)com>
Cc: Paresh Bafna <paresh(at)it(dot)iitb(dot)ac(dot)in>, Christopher Kings-Lynne <chriskl(at)familyhealth(dot)com(dot)au>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Getting table name/tuple from OID
Date: 2005-11-11 18:22:17
Message-ID: 4374E159.7020200@lewczuk.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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;

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Matt Newell 2005-11-11 18:23:01 Multi-table-unique-constraint
Previous Message Csaba Nagy 2005-11-11 17:48:33 Re: someone working to add merge?