Re: pg_generate_sequence and info_schema patch (Was: SELECT

From: Joe Conway <mail(at)joeconway(dot)com>
To: Christopher Kings-Lynne <chriskl(at)familyhealth(dot)com(dot)au>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Kris Jurka <books(at)ejurka(dot)com>, Alex <alex(at)meerkatsoft(dot)com>, Lada 'Ray' Lostak <ray(at)unreal64(dot)net>, pgsql-patches(at)postgresql(dot)org
Subject: Re: pg_generate_sequence and info_schema patch (Was: SELECT
Date: 2004-02-04 22:56:53
Message-ID: 402178B5.9050008@joeconway.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-patches

Christopher Kings-Lynne wrote:
> Having something that generates a list of dates would be handy, however
> I guess you can do it with the current series generator by adding that
> many day intervals to a base date...

Seems to work:

regression=# select current_date + s.a as dates from
generate_series(1,3) as s(a);
dates
------------
2004-02-05
2004-02-06
2004-02-07
(3 rows)

Or even:

regression=# select current_date + s.a * '1 week'::interval as dates
from generate_series(1,3) as s(a);
dates
---------------------
2004-02-11 00:00:00
2004-02-18 00:00:00
2004-02-25 00:00:00
(3 rows)

Joe

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Hadley Willan 2004-02-04 23:07:58 Improving performance with a Function instead of a View
Previous Message Hervé Piedvache 2004-02-04 20:45:59 Predictive or scoring solution for PostgreSQL ?

Browse pgsql-patches by date

  From Date Subject
Next Message Magnus Hagander 2004-02-04 23:15:44 Re: temp patch for win32 readdir issue
Previous Message Magnus Hagander 2004-02-04 22:44:03 temp patch for win32 readdir issue