From: | Thomas Hallgren <thhal(at)mailblocks(dot)com> |
---|---|
To: | Michael Fuhr <mike(at)fuhr(dot)org> |
Cc: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: Returning a RECORD, not SETOF RECORD |
Date: | 2005-04-28 19:47:45 |
Message-ID: | 42713DE1.1060603@mailblocks.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general pgsql-hackers |
Michael,
Thanks for your reply on this.
>
>>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.
>>
>>
>
>What version of PostgreSQL are you using
>
The latest and greatest from CVS.
>, and could the function
>return a specific composite type instead of RECORD?
>
This is not for a specific use-case. I want to provide rich
functionality in PL/Java but I don't understand how the actual RECORD
type is determined in cases where you don't use the function in a FROM
clause where it only makes sense (to me at least) to use a function
returning SETOF RECORD.
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?
Regards,
Thomas Hallgren
From | Date | Subject | |
---|---|---|---|
Next Message | Joshua D. Drake | 2005-04-28 19:54:22 | Re: Clustering |
Previous Message | Karsten Hilbert | 2005-04-28 19:28:14 | Re: Clustering |
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2005-04-28 21:47:18 | pgsql: Implement sharable row-level locks, and use them for foreign key |
Previous Message | Andy Astor | 2005-04-28 19:01:11 | Re: Increased company involvement |