Re: Comparing dates in DDL

From: Jeremy Finzel <finzelj(at)gmail(dot)com>
To: Rich Shepard <rshepard(at)appl-ecosys(dot)com>
Cc: "pgsql-generallists(dot)postgresql(dot)org" <pgsql-general(at)lists(dot)postgresql(dot)org>
Subject: Re: Comparing dates in DDL
Date: 2019-01-04 23:49:17
Message-ID: CAMa1XUg3TKtjDX1zg48Y=XBp_CC2c6xkzciBcaxAZZhM8f55Ew@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Fri, Jan 4, 2019 at 4:19 PM Rich Shepard <rshepard(at)appl-ecosys(dot)com>
wrote:

> On Fri, 4 Jan 2019, David G. Johnston wrote:
>
> > That would be the decision to make - does your toolkit support (or can be
> > made to support) the type and are you willing to choose a sub-optimal
> > database model because one or more applications happen to do things
> > differently?
> >
> > IMO the daterange datatype is the best type you can choose for the model;
> > now you have to figure out and decide where any tradeoffs are and if they
> > are worth it given your specific circumstances.
>
> David,
>
> Thanks for the insights.
>
> Regards,
>
> Rich

Another suggestion which hasn’t been mentioned is using ‘infinity’ as the
end date. I like this because it IMO indicates that the record is clearly
the current valid record more than null.

But I’m not sure exactly what you are trying to do either. If you are
creating a new record with changes and closing (ending) the range of the
original record, then a GIST exclusion index would ensure you have no
overlapping date ranges for all historical records put together.

Thanks,
Jeremy

>

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Rich Shepard 2019-01-04 23:59:07 Re: Comparing dates in DDL
Previous Message Kevin Brannen 2019-01-04 23:46:24 RE: Immutable way to cast timestamp TEXT to DATE? (for index)