On Jun 22, 2009, at 4:57 PM, Dario Teixeira wrote:
*However*, if I create a new type (which has an associated pg_class
entry),
and define a function which returns a SETOF that type,
RowDescription will
not tell me its OID. For example:
CREATE TYPE foobar_t AS (quant int);
CREATE FUNCTION foobar2 () RETURNS SETOF foobar_t AS
'SELECT * FROM foobar' LANGUAGE sql STABLE;
Is this a bug or a conscious decision? And on the latter case, how
can
I retrieve the pg_class OID of foobar_t?
I don't think it is a bug because the documentation clearly states "if
the field can be identified as a column of a specific table, the
object ID of the table; otherwise zero." A type is not the same as a
table.
It is not as elegant as you would like, but maybe one idea is to
create your own alias of the built in type so you can determine the
answer just by looking at the column type. For example, instead of
using "int" in CREATE TYPE above, create a your own type equivalent to
an integer.
John DeSoi, Ph.D.
--
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general