Re: [GENERAL] Returning a RECORD, not SETOF RECORD - Mailing list pgsql-hackers

From Thomas Hallgren
Subject Re: [GENERAL] Returning a RECORD, not SETOF RECORD
Date
Msg-id 4271D3A7.9050305@mailblocks.com
Whole thread Raw
Responses Re: [GENERAL] Returning a RECORD, not SETOF RECORD
List pgsql-hackers
Michael Fuhr wrote:

>On Thu, Apr 28, 2005 at 09:47:45PM +0200, Thomas Hallgren wrote:
>  
>
>>>What version of PostgreSQL are you using
>>>      
>>>
>>The latest and greatest from CVS.
>>    
>>
>
>Which branch?  HEAD?  REL8_0_STABLE?
>  
>
Sorry. To me "latest" always defaults to HEAD and by "greatest" I mean 
the coming 8.1.

>  
>
>>Wouldn't it make sense to be able to define a record in the projection 
>>part of a query, similar to what I was attempting with my SELECT? Has 
>>this been discussed or is it just considered as not very useful?
>>    
>>
>
>Sounds reasonable to me, but if it's currently possible then I
>haven't yet figured out how to do it.  I can't remember if it's
>been discussed before or not.  If nobody answers here then you
>might try pgsql-hackers.
>
>  
>
Ok. Thanks. I'll redirect this to hackers and see if I have any luck 
there. My original question was:

I do the following:

CREATE FUNCTION xyz(int, int) RETURNS RECORD AS '...'
CREATE TABLE abc(a int, b int);

Now I want to call my xyz function once for each row in abc and I want 
my RECORD to be (x int, y int, z timestamptz). How do I write that 
query? I.e. where do specify my RECORD definition? Is it possible at 
all? Ideally I'd like to write something like this:

SELECT xyz(a, b) AS (x int, y int, z timestamptz) FROM abc;

but that yields a syntax error.

Regards,
Thomas Hallgren



pgsql-hackers by date:

Previous
From: Josh Berkus
Date:
Subject: Re: [PERFORM] Distinct-Sampling (Gibbons paper) for Postgres
Next
From: Rod Taylor
Date:
Subject: Re: pg_restore stuck in a loop?