Re: date range query help - Mailing list pgsql-general

From Sam Mason
Subject Re: date range query help
Date
Msg-id 20081120114916.GJ2459@frubble.xen.chris-lamb.co.uk
Whole thread Raw
In response to date range query help  (novice <user.postgresql@gmail.com>)
Responses Re: date range query help  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-general
On Thu, Nov 20, 2008 at 01:10:41PM +1100, novice wrote:
> select * from mobile_custodian;
>
>  custodian_id | user_id | issue_date | return_date |  mobile_no
> --------------+---------+------------+-------------+-------------
>             4 |     Ben | 2008-10-11 | 2008-10-13  | 09455225998
>             5 |    Josh | 2008-10-15 |             | 09455225998

I sometimes find it easier to store ranges like this with having the
open ends at infinity.  This is easier with timestamps as they have
magic 'infinity' values in PG (both positive and negative).  Values of
date type don't have any special values like this which makes things a
bit more awkward.

I haven't seen it posted to the list for a while; but there's a nice
old book titled "Developing Time Oriented Database Applications in SQL"
that's now out of print but is available as a PDF.

  http://www.cs.arizona.edu/~rts/tdbbook.pdf


  Sam

pgsql-general by date:

Previous
From: Marcus Engene
Date:
Subject: Re: where in (select array)
Next
From: WireSpot
Date:
Subject: join with redundant results VS simpler join plus multiple selects