Skip site navigation (1) Skip section navigation (2)

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 (view raw or flat)
Thread:
Lists: pgsql-generalpgsql-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

pgsql-hackers by date

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

pgsql-general by date

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

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group