Re: Information about columns
От | John DeSoi |
---|---|
Тема | Re: Information about columns |
Дата | |
Msg-id | 733356C8-5BE9-40A7-8781-3FFC12707095@pgedit.com обсуждение исходный текст |
Ответ на | Re: Information about columns (Dario Teixeira <darioteixeira@yahoo.com>) |
Список | pgsql-general |
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.
В списке pgsql-general по дате отправления: