Re: [GENERAL] Temporal Units

2007-05-03 Thread Rich Shepard
On Wed, 2 May 2007, Lew wrote: The best solution I've encountered so far to this type of problem is to have a table of "days" with columns like isWeekday, isHoliday, julianDay, otherTidbit, ... Then you select or join the days within the interval of interest and factor out weekdays, or holidays

Re: [GENERAL] Temporal Units

2007-05-03 Thread Lew
John D. Burger wrote: There was a brief discussion of this just last week, with a few solutions suggested: http://archives.postgresql.org/pgsql-general/2007-04/msg01098.php Rich Shepard wrote: That thread asked how to find business days between any two specified dates. I would like to creat

Re: [GENERAL] Temporal Units

2007-05-03 Thread Ted Byers
Rich, I would think that as an ecologist, you would have a better sense than most here of the kinds of things I'd be doing. After all, I am a mathematical ecologist by training and the majority of applications I have developed have been either for agricultural consultants or environmental

Re: [GENERAL] Temporal Units

2007-04-30 Thread Rich Shepard
On Mon, 30 Apr 2007, Ted Byers wrote: I am not sure I see why it would be good to do this using SQL, but I do know that I have used a number of Perl packages for this sort of thing. I am not arguing with you. I just want to know in what circumstances my schemas can be improved by a calendar

Re: [GENERAL] Temporal Units

2007-04-30 Thread Rich Shepard
On Mon, 30 Apr 2007, John D. Burger wrote: There was a brief discussion of this just last week, with a few solutions suggested: http://archives.postgresql.org/pgsql-general/2007-04/msg01098.php John, That thread asked how to find business days between any two specified dates. I would like

Re: [GENERAL] Temporal Units

2007-04-30 Thread Ted Byers
I am not sure I see why it would be good to do this using SQL, but I do know that I have used a number of Perl packages for this sort of thing. When I have done this in the past, I'd do the date and time calculations in Perl and feed the result to whatever RDBMS I happen to be using (PostgreSQL

Re: [GENERAL] Temporal Units

2007-04-30 Thread Alexander Staubo
On 4/28/07, Rich Shepard <[EMAIL PROTECTED]> wrote: I would like to store a temporal frequency as NUMERIC, without units, and have the application's front end (or middleware) transform the number to the appropriate interval name. I'm having difficulties figuring out how to do this. This is a

Re: [GENERAL] Temporal Units

2007-04-30 Thread John D. Burger
Rich Shepard wrote: I wonder if a workweek/holiday calendar table for PostgreSQL already exists. If not I need to track down the procedure for creating one as Joe Celko references such a calendar in his books. I think that any schema that has temporal components needs such a table. There

Re: [GENERAL] Temporal Units

2007-04-30 Thread Rich Shepard
On Mon, 30 Apr 2007, Brent Wood wrote: If I'm following this correctly, then interval & extract timepart can be used to provide all the required functionality: Thanks, Brent. Your suggestions complete the approach I was considering. There is no need for real-time response, to checking after

Re: [GENERAL] Temporal Units

2007-04-29 Thread Brent Wood
Listmail wrote: On Sun, 29 Apr 2007 22:33:37 +0200, Rich Shepard <[EMAIL PROTECTED]> wrote: On Sun, 29 Apr 2007, Martijn van Oosterhout wrote: Then I'm afraid you havn't indicated your requirements properly. All I can see is that the interval type does exactly what you want. It can store

Re: [GENERAL] Temporal Units

2007-04-29 Thread Listmail
On Sun, 29 Apr 2007 22:33:37 +0200, Rich Shepard <[EMAIL PROTECTED]> wrote: On Sun, 29 Apr 2007, Martijn van Oosterhout wrote: Then I'm afraid you havn't indicated your requirements properly. All I can see is that the interval type does exactly what you want. It can store days, weeks, mont

Re: [GENERAL] Temporal Units

2007-04-29 Thread Rich Shepard
On Sun, 29 Apr 2007, Rich Shepard wrote: How does one define 'shift' with intervals? 0.33 DAY? On further reflection, I understand how to make the interval 'day' work by comparing the current timestamp with the month and hour. If there's no record within the necessary range, a message is e-

Re: [GENERAL] Temporal Units

2007-04-29 Thread Rich Shepard
On Sun, 29 Apr 2007, Martijn van Oosterhout wrote: Then I'm afraid you havn't indicated your requirements properly. All I can see is that the interval type does exactly what you want. It can store days, weeks, months or any combination thereof. You can multiply them and add them to dates and all

Re: [GENERAL] Temporal Units

2007-04-29 Thread Martijn van Oosterhout
On Sun, Apr 29, 2007 at 07:43:52AM -0700, Rich Shepard wrote: > Alexander's reference to the internal postgres interval support as different > from the SQL standard INTERVAL. If so, it's my mis-writing. > > Regulatory requirements are that monitoring is to be done 'once per > shift,' 'daily,' 'w

Re: [GENERAL] Temporal Units

2007-04-29 Thread Rich Shepard
On Sun, 29 Apr 2007, Tom Lane wrote: What gives you the idea that type INTERVAL is Postgres-specific? It's in the SQL standard. Tom, I know that and that was not to what I referred. Perhaps I mis-understood Alexander's reference to the internal postgres interval support as different from th

Re: [GENERAL] Temporal Units

2007-04-28 Thread Tom Lane
Rich Shepard <[EMAIL PROTECTED]> writes: >If the requirements were in days, weeks, and months I could probably find > a time unit that worked -- including the PostgreSQL-specific solution. What gives you the idea that type INTERVAL is Postgres-specific? It's in the SQL standard.

Re: [GENERAL] Temporal Units

2007-04-28 Thread Rich Shepard
On Sun, 29 Apr 2007, Alexander Staubo wrote: This is a common enough problem. Three factors come to mind: (1) Can all your intervals be expressed in absolute time units, such as number of days? "Work shift" is a human concept whose length is defined by context. Alexander, If the requiremen

Re: [GENERAL] Temporal Units

2007-04-28 Thread Alexander Staubo
On 4/28/07, Rich Shepard <[EMAIL PROTECTED]> wrote: I would like to store a temporal frequency as NUMERIC, without units, and have the application's front end (or middleware) transform the number to the appropriate interval name. I'm having difficulties figuring out how to do this. This is a

[GENERAL] Temporal Units

2007-04-28 Thread Rich Shepard
I would like to store a temporal frequency as NUMERIC, without units, and have the application's front end (or middleware) transform the number to the appropriate interval name. I'm having difficulties figuring out how to do this. For example, an event might occur once per work shift, day, we