Hi, Scott,
Scott Marlowe wrote:
But it isn't '-2 months, -1 day'. I think what you are saying is what I
am saying, that we should make the signs consistent.
Pretty much. It just seems wrong to have different signs in what is
essentially a single unit.
We don't say 42 degrees, -12 minutes
On Wed, 2006-03-08 at 06:07, Markus Schaber wrote:
Hi, Scott,
Scott Marlowe wrote:
But it isn't '-2 months, -1 day'. I think what you are saying is what I
am saying, that we should make the signs consistent.
Pretty much. It just seems wrong to have different signs in what is
Scott Marlowe [EMAIL PROTECTED] writes:
For same reasons, i.e. a need for precision, I find it hard to accept
the idea of mixing positive and negative units in the same interval.
The semantics are perfectly well defined, so I don't buy this.
regards, tom lane
Attached is the new patch. To summarize:
- new function justify_interval(interval)
- modified function justify_hours(interval)
- modified function justify_days(interval)
These functions are defined to meet the requirements as discussed in this
thread. Specifically:
- justify_hours
Mark Dilger [EMAIL PROTECTED] writes:
Tom Lane wrote:
The problem is that you can't determine what answer justify_days would
give without using the assumption 1 month == 30 days, which is an
assumption that justify_hours must not depend on.
Ahhh. So the fact that justify_days already makes
On Thu, 2006-03-02 at 00:45, Hannu Krosing wrote:
Ühel kenal päeval, K, 2006-03-01 kell 14:36, kirjutas Scott Marlowe:
But it isn't '-2 months, -1 day'. I think what you are saying is what I
am saying, that we should make the signs consistent.
Pretty much. It just seems wrong to
Ühel kenal päeval, N, 2006-03-02 kell 10:13, kirjutas Scott Marlowe:
On Thu, 2006-03-02 at 00:45, Hannu Krosing wrote:
Ühel kenal päeval, K, 2006-03-01 kell 14:36, kirjutas Scott Marlowe:
..
We don't say 42 degrees, -12 minutes when measuring arc, do we? Then
again, maybe some folks do.
On Thu, Mar 02, 2006 at 10:06:26AM -0800, Mark Dilger wrote:
I used grep -R to find all locations where interval_justify_time is
mentioned, and for each one added an analogous entry for my new function
interval_justify. But I get lost where OID=1175 is associated with
Mark Dilger [EMAIL PROTECTED] writes:
I've written the interval_justify() function but the parser does not know
about
it yet.
The pg_proc change is the only source change you need for that, but
afterwards you need to update the postgres.bki file (handled by make and
make install in
Tom Lane wrote:
Milen A. Radev [EMAIL PROTECTED] writes:
Milorad Poluga напи�а:
SELECT '10 years 1 mons 1 days'::interval - '9 years 10 mons 15 days'::interval
?column?
---
3 mons -14 days
Why not '2 mons 16 days' ?
Please read the last paragraph in section
Mark Dilger wrote:
Tom Lane wrote:
Milen A. Radev [EMAIL PROTECTED] writes:
Milorad Poluga :
SELECT '10 years 1 mons 1 days'::interval - '9 years 10 mons 15
days'::interval
?column?
---
3 mons -14 days
Why not '2 mons 16 days' ?
Please
Mark Dilger wrote:
Tom Lane wrote:
Milen A. Radev [EMAIL PROTECTED] writes:
Milorad Poluga напи�а:
SELECT '10 years 1 mons 1 days'::interval - '9 years 10 mons 15
days'::interval
?column?--- 3 mons -14 days
Why not '2 mons 16 days' ?
Please read the last
On Wed, Mar 01, 2006 at 12:59:29PM -0500, Bruce Momjian wrote:
Good question. Should we restrict days to 0 - 30 or -30 - 30? The
current system does the later:
test= select justify_days('-45 days');
justify_days
--
-1 mons -15 days
(1
Mark Dilger wrote:
select justify_hours('-73 hours'::interval);
justify_hours
---
-4 days +23:00:00
select justify_days('-62 days'::interval);
justify_days
--
-3 mons +28 days
I find the last two results somewhat
Stephan Szabo wrote:
justify_days doesn't currently do anything with this result --- it
thinks its charter is only to reduce day components that are = 30 days.
However, I think a good case could be made that it should normalize
negative days too; that is, the invariant on its result should
On Wed, 2006-03-01 at 14:18, Bruce Momjian wrote:
Stephan Szabo wrote:
justify_days doesn't currently do anything with this result --- it
thinks its charter is only to reduce day components that are = 30 days.
However, I think a good case could be made that it should normalize
Scott Marlowe wrote:
On Wed, 2006-03-01 at 14:18, Bruce Momjian wrote:
Stephan Szabo wrote:
justify_days doesn't currently do anything with this result --- it
thinks its charter is only to reduce day components that are = 30 days.
However, I think a good case could be made that it
Bruce Momjian pgman@candle.pha.pa.us writes:
I don't think we can accept a change that takes a negative and turns it
into a positive and negative.
Yeah, I find the patch's changes to the regression results pretty
disturbing.
Perhaps the correct definition ought to be like if month part = 0
Ühel kenal päeval, K, 2006-03-01 kell 15:18, kirjutas Bruce Momjian:
Stephan Szabo wrote:
justify_days doesn't currently do anything with this result --- it
thinks its charter is only to reduce day components that are = 30 days.
However, I think a good case could be made that it should
On Wed, 1 Mar 2006, Hannu Krosing wrote:
Ühel kenal päeval, K, 2006-03-01 kell 15:18, kirjutas Bruce Momjian:
Stephan Szabo wrote:
justify_days doesn't currently do anything with this result --- it
thinks its charter is only to reduce day components that are = 30 days.
However, I
Hannu Krosing wrote:
?hel kenal p?eval, K, 2006-03-01 kell 15:18, kirjutas Bruce Momjian:
Stephan Szabo wrote:
justify_days doesn't currently do anything with this result --- it
thinks its charter is only to reduce day components that are = 30 days.
However, I think a good case
Tom Lane wrote:
Bruce Momjian pgman@candle.pha.pa.us writes:
I don't think we can accept a change that takes a negative and turns it
into a positive and negative.
Yeah, I find the patch's changes to the regression results pretty
disturbing.
Perhaps the correct definition ought to be
Hannu Krosing [EMAIL PROTECTED] writes:
But unfortunately '2 mons -1 days' '1 mons 29 days'
If I want something to happen 1 day less than two months from dome date,
then the only way to say that consistently *is* '2 mons -1 days'.
Sure, but if you want to represent that then you don't pass
Tom Lane wrote:
Bruce Momjian pgman@candle.pha.pa.us writes:
I don't think we can accept a change that takes a negative and turns it
into a positive and negative.
Yeah, I find the patch's changes to the regression results pretty
disturbing.
Perhaps the correct definition ought to be like
Hannu Krosing wrote:
But unfortunately '2 mons -1 days' '1 mons 29 days'
If I want something to happen 1 day less than two months from dome date,
then the only way to say that consistently *is* '2 mons -1 days'.
Correct me if I am wrong, but I thought that justify_days would only be called
Mark Dilger [EMAIL PROTECTED] writes:
Tom Lane wrote:
I guess I would expect a good result to satisfy one of these three
cases:
* month 0 and 0 = day 30
* month 0 and -30 day = 0
* month = 0 and -30 day 30
If you believe that then 1 month -95 days should justify to
-2
On Wed, 2006-03-01 at 14:27, Bruce Momjian wrote:
Scott Marlowe wrote:
On Wed, 2006-03-01 at 14:18, Bruce Momjian wrote:
Stephan Szabo wrote:
justify_days doesn't currently do anything with this result --- it
thinks its charter is only to reduce day components that are = 30
Tom Lane wrote:
Mark Dilger [EMAIL PROTECTED] writes:
Tom Lane wrote:
I guess I would expect a good result to satisfy one of these three
cases:
* month 0 and 0 = day 30
* month 0 and -30 day = 0
* month = 0 and -30 day 30
If you believe that then 1 month -95
Mark Dilger [EMAIL PROTECTED] writes:
The current code (without the patch) behaves as follows:
select justify_days(justify_hours('1 month 95 days -36:00:00'::interval));
justify_days
-
4 mons 4 days -12:00:00
So? If we liked the current behavior
Tom Lane wrote:
Mark Dilger [EMAIL PROTECTED] writes:
The current code (without the patch) behaves as follows:
select justify_days(justify_hours('1 month 95 days -36:00:00'::interval));
justify_days
-
4 mons 4 days -12:00:00
So? If we liked the
Mark Dilger wrote:
Your proposal is that justify_hours borrows 24 hours from the days column in
order to bring the -12 hours up to a positive 12 hours. Should it only do
that
if the days column is a positive number? What if it is negative?
I think we all agree on the following but
Bruce Momjian wrote:
Mark Dilger wrote:
Your proposal is that justify_hours borrows 24 hours from the days column in
order to bring the -12 hours up to a positive 12 hours. Should it only do that
if the days column is a positive number? What if it is negative?
I think we all agree on the
A new patch is attached. Please note the regression differences.
mark
Index: src/backend/utils/adt/timestamp.c
===
RCS file: /projects/cvsroot/pgsql/src/backend/utils/adt/timestamp.c,v
retrieving revision 1.160
diff --context=5
Bruce Momjian pgman@candle.pha.pa.us writes:
Imagine this:
'1 mons -2 days -12:00:00'
Which sign do we head to for this? For justify_hours, if we don't look
at the months it remains unchange, but calling justify_days we get:
'28 days -12:00:00'
which is wrong (negative and
Tom Lane wrote:
Mark Dilger [EMAIL PROTECTED] writes:
Am I correct that the second case should still have negative hours?
Yes...
If so, then justify_hours(...) needs to examine the sign of the days
and months portion of the interval while performing its work.
No, it should ignore the
Tom Lane wrote:
Bruce Momjian pgman@candle.pha.pa.us writes:
Imagine this:
'1 mons -2 days -12:00:00'
Which sign do we head to for this? For justify_hours, if we don't look
at the months it remains unchange, but calling justify_days we get:
'28 days -12:00:00'
which
Bruce Momjian wrote:
If we do that, we should just call it justify_interval(). I am thinking
this is the direction to go, and for people who want more control they
use the justify_hours and justify_days, and those are left unchanged.
I agree. Let's leave the existing functions alone. I can
Bruce Momjian pgman@candle.pha.pa.us writes:
Tom Lane wrote:
Based on that, I guess I have to change my vote: justify_hours should
still not look at the month (because it shouldn't use the month=30days
assumption), but justify_days should be changed to be effectively a
combination of both
Tom Lane wrote:
Well, the question is whether justify_days has a sane definition that is
different from this. Based on your example, I'm not seeing one.
Backwards compatibility is probably more important than sanity. Let's just
deprecate the existing functions and recommend that people use
Tom Lane wrote:
Bruce Momjian pgman@candle.pha.pa.us writes:
Tom Lane wrote:
Based on that, I guess I have to change my vote: justify_hours should
still not look at the month (because it shouldn't use the month=30days
assumption), but justify_days should be changed to be effectively a
Bruce Momjian pgman@candle.pha.pa.us writes:
Well, the question is whether justify_days has a sane definition that is
different from this. Based on your example, I'm not seeing one.
Uh, justify days only deals with days -- months conversions. There is
no processing for hours. I don't
Mark Dilger [EMAIL PROTECTED] writes:
Bruce Momjian wrote:
If we do that, we should just call it justify_interval(). I am thinking
this is the direction to go, and for people who want more control they
use the justify_hours and justify_days, and those are left unchanged.
I agree. Let's
Mark Dilger [EMAIL PROTECTED] writes:
This overall design seems more flexible than Tom's recent post in which he
stated that justify_days should call justify_hours internally.
AFAIR I said the exact opposite.
regards, tom lane
---(end of
Mark Dilger wrote:
Tom Lane wrote:
Well, the question is whether justify_days has a sane definition that is
different from this. Based on your example, I'm not seeing one.
Backwards compatibility is probably more important than sanity. Let's just
deprecate the existing functions and
Tom Lane wrote:
Mark Dilger [EMAIL PROTECTED] writes:
This overall design seems more flexible than Tom's recent post in which he
stated that justify_days should call justify_hours internally.
AFAIR I said the exact opposite.
regards, tom lane
Tom Lane also wrote:
Bruce Momjian wrote:
Even if we had people do:
justify_hours(justify_days(justify_hours()))
I don't think that would do what we want in all cases. Consider '1 mon
-1 hour'. That should be '29 days 23 hours' but neither existing
function, even if modified, will allow us to return
Mark Dilger [EMAIL PROTECTED] writes:
justify_days(justify_hours(...)) fixes *everything* in the most recently
submitted patch, regardless of the convoluted case you invent. There is no
data
for which it won't work.
If so, one function or the other is cheating. Per discussion,
Tom Lane wrote:
Mark Dilger [EMAIL PROTECTED] writes:
justify_days(justify_hours(...)) fixes *everything* in the most recently
submitted patch, regardless of the convoluted case you invent. There is no data
for which it won't work.
If so, one function or the other is cheating. Per
Mark Dilger [EMAIL PROTECTED] writes:
Tom Lane wrote:
If so, one function or the other is cheating.
That depends what you mean by cheating. The justify_hours function
looks to see what answer justify_days would give, but does not
actually change the data. I described this all earlier and I
Tom Lane wrote:
Mark Dilger [EMAIL PROTECTED] writes:
Tom Lane wrote:
If so, one function or the other is cheating.
That depends what you mean by cheating. The justify_hours function
looks to see what answer justify_days would give, but does not
actually change the data. I described
Ühel kenal päeval, K, 2006-03-01 kell 14:36, kirjutas Scott Marlowe:
But it isn't '-2 months, -1 day'. I think what you are saying is what I
am saying, that we should make the signs consistent.
Pretty much. It just seems wrong to have different signs in what is
essentially a single
Hannu Krosing schrieb:
Ühel kenal päeval, K, 2006-03-01 kell 14:36, kirjutas Scott Marlowe:
...
But we do say both quarter past three (3 hours 15 min) and quarter to
four (4 hours -15 min) when talking about time.
but luckily we dont write it ;)
Some people say (like ) this: quarter past 3,
Milen A. Radev [EMAIL PROTECTED] writes:
Milorad Poluga напиÑа:
SELECT '10 years 1 mons 1 days'::interval - '9 years 10 mons 15
days'::interval
?column?
---
3 mons -14 days
Why not '2 mons 16 days' ?
Please read the last paragraph in section 8.5.1.4 of the
On Sat, 18 Feb 2006, Tom Lane wrote:
Milen A. Radev [EMAIL PROTECTED] writes:
Milorad Poluga :
SELECT '10 years 1 mons 1 days'::interval - '9 years 10 mons 15
days'::interval
?column?
---
3 mons -14 days
Why not '2 mons 16 days' ?
Please read the last
54 matches
Mail list logo