X-Original-To: pgsql-sql@postgresql.org Received: from localhost (developer.postgresql.org [64.117.224.193]) by developer.postgresql.org (Postfix) with ESMTP id 51FDD9250E4 for ; Sun, 25 May 2003 18:42:12 -0400 (EDT) Received: from developer.postgresql.org ([64.117.224.193]) by localhost (developer.postgresql.org [64.117.224.193:10024]) (amavisd-new) with ESMTP id 60027-02 for ; Sun, 25 May 2003 18:42:07 -0400 (EDT) Received: from niobium.golden.net (niobium.golden.net [199.166.210.90]) by developer.postgresql.org (Postfix) with ESMTP id 1D2EC92507B for ; Sun, 25 May 2003 18:42:07 -0400 (EDT) Received: from dobber.ca (178-246.SPEEDe.golden.net [216.75.178.246]) by niobium.golden.net (8.11.6/8.10.1) with SMTP id h4PMg6D15411 for ; Sun, 25 May 2003 18:42:06 -0400 (EDT) Received: (qmail 29354 invoked by uid 500); 25 May 2003 21:44:25 -0000 Received: from localhost (sendmail-bs@127.0.0.1) by localhost with SMTP; 25 May 2003 21:44:25 -0000 Date: Sun, 25 May 2003 17:44:25 -0400 (EDT) From: Rob Wood To: pgsql-sql@postgresql.org Subject: date interpolation Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Virus-Scanned: by amavisd-new X-Archive-Number: 200305/491 X-Sequence-Number: 13656 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