Thanks for the quick reply. I made a mistake last time by asking the question:
actually, i would like to know how to get the OID from a table name or operator name.
For example, ">" is 512 while "=" is 96. and some table has the magic relid of 20078, say.
How could I find out the OID by giving the (full qualified) name of a table or an operator?
I need this since I want to build a query plan from external and I need to know the OID
in order to manually create the query plan. Thanks.
> 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;