Casting 'record' to a composite type.

From: Mark Gibson <gibsonm(at)cromwell(dot)co(dot)uk>
To: pgsql-general(at)postgresql(dot)org
Subject: Casting 'record' to a composite type.
Date: 2004-02-06 14:04:04
Message-ID: 40239ED4.4010000@cromwell.co.uk
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hello,
When using functions that return the datatype 'record', rather than
doing this:

SELECT *
FROM fn_returning_setof_record( ... )
AS t (id integer, title text);

I'd like to do something like this:

CREATE TYPE my_type AS (id integer, title text);

SELECT *
FROM fn_returning_setof_record( ... )
AS t my_type;
or
SELECT *
FROM fn_returning_setof_record( ... )::my_type AS t;

Obviously the last two statements don't work, but you can see what I'm
getting at,
casting the 'record' datatype to a composite datatype.
I've not been able to find anything like this in the docs.
Is there currently any way of doing this? are there any plans for it?

Cheers

--
Mark Gibson <gibsonm |AT| cromwell |DOT| co |DOT| uk>
Web Developer & Database Admin
Cromwell Tools Ltd.
Leicester, England.

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Aaron Bratcher 2004-02-06 14:10:23 Re: newbie question... how do I get table structure?
Previous Message Harald Fuchs 2004-02-06 13:12:13 Re: newbie question... how do I get table structure?