Documentation for generate_series() functions committed a few days ago.
authorJoe Conway
Thu, 5 Feb 2004 22:54:36 +0000 (22:54 +0000)
committerJoe Conway
Thu, 5 Feb 2004 22:54:36 +0000 (22:54 +0000)
doc/src/sgml/func.sgml

index 259928e173dc2c8d0ef1eb41d374e090d0065fb0..91ab4b12ae3da7a2eedf7ebbcae78616e26de406 100644 (file)
@@ -1,5 +1,5 @@
 
 
@@ -8199,6 +8199,96 @@ AND
   
  
 
+  Set Returning Functions
+
+  
+   set returning functions
+   functions
+  
+
+  
+   This section describes functions that possibly return more than one row.
+   Currently the only functions in this class are series generating functions,
+   as detailed in .
+  
+
+  
+   Series Generating Functions
+   
+    
+     
+      Function
+      Argument Type
+      Return Type
+      Description
+     
+    
+
+    
+     
+      generate_series(startstop)
+      int or bigint
+      setof int or setof bigint (same as argument type)
+      
+       Generate a series of values, from start to stop
+       with a step size of one.
+      
+     
+
+     
+      generate_series(startstopstep)
+      int or bigint
+      setof int or setof bigint (same as argument type)
+      
+       Generate a series of values, from start to stop
+       with a step size of step.
+      
+     
+
+    
+   
+  
+
+  
+   When step is positive, zero rows are returned if
+   start is greater than stop.
+   Conversely, when step is negative, zero rows are
+   returned if start is less than stop.
+   Zero rows are also returned for NULL inputs. It is an error
+   for step to be zero. Some examples follow:
+
+select * from generate_series(2,4);
+ generate_series
+-----------------
+               2
+               3
+               4
+(3 rows)
+
+select * from generate_series(5,1,-2);
+ generate_series
+-----------------
+               5
+               3
+               1
+(3 rows)
+
+select * from generate_series(4,3);
+ generate_series
+-----------------
+(0 rows)
+
+select current_date + s.a as dates from generate_series(0,14,7) as s(a);
+   dates
+------------
+ 2004-02-05
+ 2004-02-12
+ 2004-02-19
+(3 rows)
+
+