View Single Post

   
  #1 (permalink)  
Old 04-11-2008, 04:37 AM
Thomas Hallgren
 
Posts: n/a
Default Re: [GENERAL] Returning a RECORD, not SETOF RECORD

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


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

Reply With Quote