[GENERAL] Functions returning RECORD

2005-04-21 Thread Thomas Hallgren
I have a question about syntax and feasibility. 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

Re: [GENERAL] Functions returning RECORD

2005-01-14 Thread postgresql
This was very helpfull. Thank you Craig > On Thu, Jan 13, 2005 at 07:58:33PM +0200, Craig Bryden wrote: > >> When I run select * from GetAccountInfo (100)I get the following >> error message: >> ERROR: a column definition list is required for functions returning >> "record" > > If the f

Re: [GENERAL] Functions returning RECORD

2005-01-13 Thread Stephan Szabo
On Thu, 13 Jan 2005, Craig Bryden wrote: > When I run select * from GetAccountInfo (100) > I get the following error message: ERROR: a column definition list is > required for functions returning "record" You need to say something like: select * from GetAccountInfo(100) AS foo(field1 int, fiel

Re: [GENERAL] Functions returning RECORD

2005-01-13 Thread Pavel Stehule
Hello try select * from GetAccountInfo (100) as (integer, integer, integer); I don't know types of fields a.Field1, a.Field2, a.Field4. I expect for example all are integer. regards Pavel Stehule On Thu, 13 Jan 2005, Craig Bryden wrote: > Hi > > I come from a MS-SQL background and am trying

Re: [GENERAL] Functions returning RECORD

2005-01-13 Thread Michael Fuhr
On Thu, Jan 13, 2005 at 07:58:33PM +0200, Craig Bryden wrote: > When I run select * from GetAccountInfo (100)I get the following > error message: > ERROR: a column definition list is required for functions returning "record" If the function will always return the same row type then creat

[GENERAL] Functions returning RECORD

2005-01-13 Thread Craig Bryden
Hi   I come from a MS-SQL background and am trying to figure out what is wrong with the function below: * CREATE OR REPLACE FUNCTION GetAccountInfo (p_AccID int)RETURNS record AS$$DECLARE r_Return record;