Problems returning multiple columns - Mailing list pgsql-sql

From Travis Hoyt
Subject Problems returning multiple columns
Date
Msg-id DBEMKMGOMJAGKAKEPPEGOEKCDOAA.thoyt@npc.net
Whole thread Raw
List pgsql-sql
CREATE FUNCTION wklyavg(numeric, timestamp, timestamp) RETURNS TEXT AS '        DECLARE                system
ALIASFOR $1;                startdate       ALIAS FOR $2;                enddate         ALIAS FOR $3;
result         numeric;
 
        BEGIN                result := (select (avg(usr) + avg(sys)) from sardata                       where systemid
=system and time between startdate
 
and enddate);                return enddate || result;        END;
' LANGUAGE 'plpgsql';

Above is the function I'm trying to run and I keep getting errors telling
me I need to cast my values.  I've played with it a bit but not knowing
much about casting I was hoping for some help.  I'm basically just summing
a couple of averages for values between two given dates.  I wanted to
return the summed average and the "enddate" as one row.  Any suggestions?

Thanks,

Travis

pgsql-sql by date:

Previous
From: "Nick Fankhauser"
Date:
Subject: Re: convert from sybase to postgresql
Next
From: Stephan Szabo
Date:
Subject: Re: problem with update from subselect