Casting 'record' to a composite type. - Mailing list pgsql-general

From Mark Gibson
Subject Casting 'record' to a composite type.
Date
Msg-id 40239ED4.4010000@cromwell.co.uk
Whole thread Raw
Responses Re: Casting 'record' to a composite type.
List 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.


pgsql-general by date:

Previous
From: Harald Fuchs
Date:
Subject: Re: newbie question... how do I get table structure?
Next
From: Aaron Bratcher
Date:
Subject: Re: newbie question... how do I get table structure?