Re: Information about columns

Поиск
Список
Период
Сортировка
От Dario Teixeira
Тема Re: Information about columns
Дата
Msg-id 254096.3441.qm@web111514.mail.gq1.yahoo.com
обсуждение исходный текст
Ответ на Information about columns  (Dario Teixeira <darioteixeira@yahoo.com>)
Ответы Re: Information about columns  (John DeSoi <desoi@pgedit.com>)
Re: Information about columns  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-general
Hi,

> The information you want is always returned from the query
> as a row description message. This includes the type oid of
> real and computed columns.
>
> See the RowDescription message on this page for details:

Thanks for the reply.  Note that is in fact RowDescription that PG'OCaml
is already using to obtain the type oid of real and computed columns.
The problem is that in some circumstances RowDescription does not provide
a pg_class OID where I (naïvely perhaps) expect it.

To be more precise, when issuing a SELECT for tables and views, the
associated pg_class OID is always provided.  Doing a SELECT on 'foobar'
and 'foobar1' will work:

CREATE TABLE foobar (quant int);

CREATE VIEW foobar1 AS SELECT * FROM foobar;

*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?

Thanks again,
Dario Teixeira





В списке pgsql-general по дате отправления:

Предыдущее
От: Scott Marlowe
Дата:
Сообщение: Re: Select ranges based on sequential breaks
Следующее
От: Jorge Vidal - Disytel
Дата:
Сообщение: Compiling Pl/Java