Re: [GENERAL] Returning a RECORD, not SETOF RECORD

From: Thomas Hallgren <thhal(at)mailblocks(dot)com>
To: Michael Fuhr <mike(at)fuhr(dot)org>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: [GENERAL] Returning a RECORD, not SETOF RECORD
Date: 2005-04-29 06:26:47
Message-ID: 4271D3A7.9050305@mailblocks.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general 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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message fisher 2005-04-29 06:30:46 temp tables ORACLE/PGSQL
Previous Message Michael Fuhr 2005-04-29 05:57:02 Re: Returning a RECORD, not SETOF RECORD

Browse pgsql-hackers by date

  From Date Subject
Next Message Sokolov Yura 2005-04-29 11:54:27 PseudoPartitioning and agregates
Previous Message Michael Fuhr 2005-04-29 05:57:02 Re: Returning a RECORD, not SETOF RECORD