pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
date interpolation
2+ messages / 2 participants
[nested] [flat]

* date interpolation
@ 2003-05-25 21:44 Rob Wood <rhwood@dobber.ca>
  2003-05-26 02:37 ` Re: date interpolation Rod Taylor <rbt@rbt.ca>
  0 siblings, 1 reply; 2+ messages in thread

From: Rob Wood @ 2003-05-25 21:44 UTC (permalink / raw)
  To: 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




^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: date interpolation
  2003-05-25 21:44 date interpolation Rob Wood <rhwood@dobber.ca>
@ 2003-05-26 02:37 ` Rod Taylor <rbt@rbt.ca>
  0 siblings, 0 replies; 2+ messages in thread

From: Rod Taylor @ 2003-05-26 02:37 UTC (permalink / raw)
  To: Rob Wood <rhwood@dobber.ca>; +Cc: pgsql-sql

> 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.

Looks to me like the perfect candidate for a Set Returning Function.

-- 
Rod Taylor <rbt@rbt.ca>

PGP Key: http://www.rbt.ca/rbtpub.asc

Attachments:

  signature.asc (application/pgp-signature, 186B) download

^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2003-05-26 02:37 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2003-05-25 21:44 date interpolation Rob Wood <rhwood@dobber.ca>
2003-05-26 02:37 ` Rod Taylor <rbt@rbt.ca>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox