Waiting for 9.5 – Add generate_series(numeric, numeric).

On 11th of November, Fujii Masao committed patch:

Add generate_series(numeric, numeric).
 
Платон Малюгин
Reviewed by Michael Paquier, Ali Akbar and Marti Raudsepp

generate_series() is one of the most commonly used functions – at least for me.

If you're not familiar with it – it generates set of rows with values based on arguments. For example:

$ SELECT generate_series(1,10) i;
 i  
----
  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
(10 ROWS)

Or:

SELECT generate_series('2014-01-01 00:00:00'::TIMESTAMP, now(), '65 days 7 hours 13 minutes 2 seconds'::INTERVAL);
    generate_series     
------------------------
 2014-01-01 00:00:00+01
 2014-03-07 07:13:02+01
 2014-05-11 14:26:04+02
 2014-07-15 21:39:06+02
 2014-09-19 04:52:08+02
(5 ROWS)

So far we had versions of the functions working on integers, and timestamps (both with time zone and without). Now we got also version that works on numeric values.

Technically, we were able to numerics from generate_series by doing casts and possibly some calculations, now it's simpler than ever:

SELECT generate_series(10.1, 15.1);
 generate_series 
-----------------
            10.1
            11.1
            12.1
            13.1
            14.1
            15.1
(6 ROWS)

Or the three-argument version:

SELECT generate_series(10.1, 15.1, 2.2356);
 generate_series 
-----------------
            10.1
         12.3356
         14.5712
(3 ROWS)

Cool. That will definitely be helpful. Thanks guys.