title: REDSHIFT: How can I generate a series of numbers without creating a table called "numbers" in redshift (Postgres 8.0.2)?
body: <p>I need to create an empty time table series for a report so I can left join activity from several tables to it. Every hour of the day does not necessarily have data, but I want it to show null or zero for inactivity instead of omitting that hour of the day.</p>
  
  <p>In later versions of Postgres (post 8.0.2), this is easy in several ways:</p>
  
  <p><code>SELECT unnest(array[0,1,2,3,4...]) as numbers</code></p>
  
  <p>OR</p>
  
  <p><code>CROSS JOIN (select generate_series as hours
              from generate_series(now()::timestamp,
                                   now()::timestamp + interval '1 day',
                                   '1 hour'::interval
              )) date_series</code></p>
  
  <p>Redshift can run some of these commands, but throws an error when you attempt to run it in conjunction with any of the tables. </p>
  
  <p><strong>WHAT I NEED:</strong></p>
  
  <p>A reliable way to generate a series of numbers (e.g. 0-23) <em>as a subquery</em> that will run on redshift (uses postgres 8.0.2).</p>