title: Using sql function generate_series() in redshift
body: <p>I'd like to use the generate series function in redshift, but have not been successful.</p>
  
  <p>The redshift documentation says it's not supported. The following code does work:  </p>
  
  <pre><code>select *
  from generate_series(1,10,1)
  </code></pre>
  
  <p>outputs:</p>
  
  <pre><code>1
  2
  3
  ...
  10
  </code></pre>
  
  <p>I'd like to do the same with dates. I've tried a number of variations, including:  </p>
  
  <pre><code>select *
  from generate_series(date('2008-10-01'),date('2008-10-10 00:00:00'),1)
  </code></pre>
  
  <p>kicks out:</p>
  
  <pre><code> ERROR: function generate_series(date, date, integer) does not exist
   Hint: No function matches the given name and argument types.
   You may need to add explicit type casts. [SQL State=42883]
  </code></pre>
  
  <p>Also tried:  </p>
  
  <pre><code>select *
  from generate_series('2008-10-01 00:00:00'::timestamp,
  '2008-10-10 00:00:00'::timestamp,'1 day')
  </code></pre>
  
  <p>And tried: </p>
  
  <pre><code>select *
  from generate_series(cast('2008-10-01 00:00:00' as datetime),
  cast('2008-10-10 00:00:00' as datetime),'1 day')
  </code></pre>
  
  <p>both kick out:</p>
  
  <pre><code>ERROR: function generate_series(timestamp without time zone, timestamp without time zone, "unknown") does not exist
  Hint: No function matches the given name and argument types.
  You may need to add explicit type casts. [SQL State=42883]
  </code></pre>
  
  <p>If not looks like I'll use this code from another post:  </p>
  
  <pre><code>SELECT to_char(DATE '2008-01-01'
  + (interval '1 month' * generate_series(0,57)), 'YYYY-MM-DD') AS ym
  </code></pre>
  
  <p><a href="https://stackoverflow.com/questions/7955407/postgresql-generate-series-with-sql-function-as-arguments">PostgreSQL generate_series() with SQL function as arguments</a></p>