By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
464,603 Members | 1,057 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 464,603 IT Pros & Developers. It's quick & easy.

Casting 'record' to a composite type.

P: n/a
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.
---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

http://archives.postgresql.org

Nov 22 '05 #1
Share this Question
Share on Google+
1 Reply

P: n/a
Mark Gibson wrote:
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; 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?


There is no way to do this now, and no plans that I know of, but it does
look useful. I'm not sure how painful it would be to make it happen
though...

Joe

---------------------------(end of broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to ma*******@postgresql.org

Nov 22 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.