date interpolation

From: Rob Wood <rhwood(at)dobber(dot)ca>
To: pgsql-sql(at)postgresql(dot)org
Subject: date interpolation
Date: 2003-05-25 21:44:25
Message-ID: Pine.LNX.4.44.0305251736050.29182-100000@dobber.ca
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

I am looking for a way to interpolate dates to create a nice output table.

example:

given this table:
id | start_date | end_date
----+------------+-----------
101 | 2003-02-03 | 2003-02-05
102 | 2003-03-20 | 2003-03-24
:
:

I am looking for a SELECT to retrieve this table:
id | date
----+------------
101 | 2003-02-03
101 | 2003-02-04
101 | 2003-02-05
102 | 2003-03-20
102 | 2003-03-21
102 | 2003-03-22
102 | 2003-03-23
102 | 2003-03-24
:
:

So far the closest solution I have come up with involves creating a dummy
table that contains a long list of dates that I can JOIN against in order
to fill in the interpolated values. It doesn't work very well, and gets
slow with large tables.

any clever ideas would be appreciated.

Rob

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Josh Berkus 2003-05-25 22:11:47 Quick question regarding indexes and NULLs in 7.3.3 -> 7.4
Previous Message Markus Bertheau 2003-05-25 18:22:17 Re: select lower('ÆØÅ ABC'); does