Re: Information about columns - Mailing list pgsql-general

From Dario Teixeira
Subject Re: Information about columns
Date
Msg-id 254096.3441.qm@web111514.mail.gq1.yahoo.com
Whole thread Raw
In response to Information about columns  (Dario Teixeira <darioteixeira@yahoo.com>)
Responses Re: Information about columns
Re: Information about columns
List 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 by date:

Previous
From: Scott Marlowe
Date:
Subject: Re: Select ranges based on sequential breaks
Next
From: Jorge Vidal - Disytel
Date:
Subject: Compiling Pl/Java