Re: Help on a complex query (avg data for day of the week)

From: Michael Fuhr <mike(at)fuhr(dot)org>
To: Matthew Smith <mps(at)utas(dot)edu(dot)au>
Cc: Richard Huxton <dev(at)archonet(dot)com>, pgsql-sql(at)postgresql(dot)org
Subject: Re: Help on a complex query (avg data for day of the week)
Date: 2005-12-22 02:37:55
Message-ID: 20051222023755.GA62008@winnie.fuhr.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

On Thu, Dec 22, 2005 at 11:59:24AM +1100, Matthew Smith wrote:
> Sadly I am using 7.3, it seems that generate_series() is 8.0 and later.

Yes, but it's easily written in PL/pgSQL for earlier versions.
Example:

CREATE FUNCTION generate_series(integer, integer)
RETURNS SETOF integer AS '
DECLARE
i integer;
BEGIN
FOR i IN $1 .. $2 LOOP
RETURN NEXT i;
END LOOP;
RETURN;
END;
' LANGUAGE plpgsql VOLATILE STRICT;

--
Michael Fuhr

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Premsun Choltanwanich 2005-12-22 02:44:35 lo function changed in PostgreSQL 8.1.1 (ask again)
Previous Message Matthew Smith 2005-12-22 00:59:24 Re: Help on a complex query (avg data for day of the week)