From: | "Josh Berkus" <josh(at)agliodbs(dot)com> |
---|---|
To: | Allan Engelhardt <allane(at)cybaea(dot)com>, Josh Berkus <josh(at)agliodbs(dot)com>, pgsql-sql(at)postgresql(dot)org |
Subject: | Re: Re: Data type confusion |
Date: | 2001-08-06 20:55:43 |
Message-ID: | web-97584@davinci.ethosmedia.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
Allan,
> I see now what you are trying to do. It sort of makes sense, but I'm
> still really reluctant to give (semantic or otherwise) meaning to
> "yesterday divided by tomorrow" .....
I don't agree. Consider, for example, this statement:
'30 weeks ago'::INTERVAL / '2 weeks'::INTERVAL = -15
Just as
-30 / 2 = -15
To phrase the equation above: "How many two week periods is thirty
weeks ago? Minus fifteen, or fifteen ago."
This makes perfect sense to me.
> It seems to me that such a function would be more generally useful
> than the division of intervals. What you really want to do is not to
> divide intervals, but to express them in different time units. Or am
> I missing something (again)?
From my pespective? Yes, you are. (For one thing, the CONVERT function
in Postgres converts between unicode character sets, not data-types).
Look, if I'm designing a payroll application for a company with
bi-weekly payroll, I will want a report that shows how many payroll
periods for which an employee has been employed. Thus I will want to:
periods_employed := (current_timestamp - date_hired) / '2
weeks'::INTERVAL
I don't want to go through a bunch of non-ANSI SQL-compliant conversion
functions to do it. Especially not as this is just what the ANSI SQL
data type and operator specs are designed to support.
-Josh
______AGLIO DATABASE SOLUTIONS___________________________
Josh Berkus
Complete information technology josh(at)agliodbs(dot)com
and data management solutions (415) 565-7293
for law firms, small businesses fax 621-2533
and non-profit organizations. San Francisco
From | Date | Subject | |
---|---|---|---|
Next Message | Thomas Good | 2001-08-06 21:14:50 | Re: prob with PERL/Postgres |
Previous Message | Allan Engelhardt | 2001-08-06 20:54:59 | Re: prob with PERL/Postgres |