Re: Help on a complex query (avg data for day of the week) - Mailing list pgsql-sql

From Michael Fuhr
Subject Re: Help on a complex query (avg data for day of the week)
Date
Msg-id 20051222023755.GA62008@winnie.fuhr.org
Whole thread Raw
In response to Re: Help on a complex query (avg data for day of the week)  (Matthew Smith <mps@utas.edu.au>)
Responses Re: Help on a complex query (avg data for day of the week)  (Matthew Smith <mps@utas.edu.au>)
List 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


pgsql-sql by date:

Previous
From: Matthew Smith
Date:
Subject: Re: Help on a complex query (avg data for day of the week)
Next
From: "Premsun Choltanwanich"
Date:
Subject: lo function changed in PostgreSQL 8.1.1 (ask again)