How to return a modified array from a user-define function...

From: "D(dot) Jay Newman" <jay(at)sprucegrove(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: How to return a modified array from a user-define function...
Date: 2000-08-18 21:24:25
Message-ID: 200008182124.RAA23499@sprucegrove.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi:

I would like to create a standard deviation function using the basic
SQL statements "CREATE AGGREGATE" and "CREATE FUNCTION" using Postgres 7.0.2.

I can't find a way to return a modified array.

I've tried things like:

CREATE function x (_float8, float8) RETURNS _float8 AS
'SELECT {$1[1] + 1, $1[2] + $2, $1[3] + ($2 * $2)};'
LANGUAGE 'sql';

This doesn't work. I get the following error:

ERROR: parser: parse error at or near "{"

Any help will be appreciated!
--
D. Jay Newman ! For the pleasure and the profit it derives
jay(at)sprucegrove(dot)com ! I arrange things, like furniture, and
http://www.sprucegrove.com/~jay/ ! daffodils, and ...lives. -- Hello Dolly

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Stephan Szabo 2000-08-18 21:57:06 Re: BIG PROBLEM !!!
Previous Message Trond Eivind=?iso-8859-1?q?_Glomsr=F8d?= 2000-08-18 20:50:22 Re: PG 7.0.2 Install