Kris Jurka wrote:
A useful generic function would be one something like range(min,max) that
would return a set of rows so you wouldn't have to actually have a table.


You mean like this?


CREATE OR REPLACE FUNCTION test(int,int) RETURNS SETOF int AS '
BEGIN
  FOR i IN $1..$2 LOOP
    RETURN NEXT i;
  END LOOP;
  RETURN;
END;
' LANGUAGE 'plpgsql' STRICT IMMUTABLE;

regression=# select * from test(4, 8);
 test
------
    4
    5
    6
    7
    8
(5 rows)

HTH,

Joe



---------------------------(end of broadcast)---------------------------
TIP 7: don't forget to increase your free space map settings

Reply via email to