Skip site navigation (1) Skip section navigation (2)

Re: Calculating repeating events - functionality lost with the demise of tinterval ?

From: Daniel <psql-novice(at)netzach(dot)co(dot)il>
To: pgsql-novice(at)postgresql(dot)org
Subject: Re: Calculating repeating events - functionality lost with the demise of tinterval ?
Date: 2008-07-02 15:37:28
Message-ID: 486BA0B8.4070906@netzach.co.il (view raw or flat)
Thread:
Lists: pgsql-novice
>> I need to know whether a repeating event occurs or not on a particular
>> day. I currently have the following information:
>>
>> date of first occurrence (date)
>> repeat frequency (interval)
>> date to check (date)
>>
>> My instinct says that I should be using a mod here to calculate whether
>> the remainder is zero when the difference between the two times is
>> divided by the repeat frequency. Unfortunately this is not possible
>> since as far as I am aware intervals only specify a time length and not
>> two dates.
> Huh?  If you only need this good to day precision, as your reference to
> dates suggests, then just subtract the two dates (which will give an
> integer number of days) and modulo by the repeat frequency (also given
> as an integer number of days).
>
> If that doesn't satisfy your requirements, you need to be more clear
> about what they are.
Apologies for the lack of clarity.

Try repeat_frequency='1 month'

Netzach

In response to

Responses

pgsql-novice by date

Next:From: Phillip SitbonDate: 2008-07-02 16:44:21
Subject: Concurrent COPY commands
Previous:From: Tom LaneDate: 2008-07-02 15:25:57
Subject: Re: Table exists but can't drop.

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group