Skip site navigation (1) Skip section navigation (2)

Re: generate_series() Interpretation

From: "David E(dot) Wheeler" <david(at)kineticode(dot)com>
To: Kevin Grittner <Kevin(dot)Grittner(at)wicourts(dot)gov>
Cc: "PostgreSQL Hackers" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: generate_series() Interpretation
Date: 2011-06-27 18:06:35
Message-ID: E472FE99-31AE-4DC7-BE9A-EB9883BF39AE@kineticode.com (view raw or flat)
Thread:
Lists: pgsql-hackers
On Jun 27, 2011, at 11:03 AM, Kevin Grittner wrote:

> It is precisely to support such fancy things that some products
> support a more abstract date type which allows 31 days in any month,
> and then normalizes to real dates as needed.  The PostgreSQL
> developer community has generally not been receptive to such use
> cases.  I think you need to iterate through month intervals and add
> those to the starting date for now.  If you want to start with the
> last day of a month with less than 31 days, you may need to back up
> a month or two to find a suitable month and offset your intervals by
> the appropriate number of months.
> 
> I'd bet that if you encapsulate all that in a PostgreSQL function,
> you're not the only one who would find it useful.

Yeah, did that a while ago:

  http://www.justatheory.com/computers/databases/postgresql/recurring_events.html

I think it could be simpler now, with generate_series() for some intervals.

Best,

David


In response to

pgsql-hackers by date

Next:From: Josh BerkusDate: 2011-06-27 18:08:58
Subject: Commitfest 2001-06: 10 days in
Previous:From: Robert HaasDate: 2011-06-27 18:05:23
Subject: Re: per-column generic option

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group