From: | Mark Dilger <pgsql(at)markdilger(dot)com> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us> |
Subject: | Re: [SQL] Interval subtracting |
Date: | 2006-03-03 20:25:58 |
Message-ID: | 4408A656.8070405@markdilger.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers pgsql-patches pgsql-sql |
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 makes certain the sign bit on the hours
matches the sign bit on the days. It only checks the
sign bit on the days, and not the months, when
determining if the hours should be positive or negative.
After the call, -24 < hours < 24.
- justify_days makes certain the sign bit on the days
matches the sign bit on the months. It's behavior does
not depend on the hours, nor does it modify the hours.
After the call, -30 < days < 30.
- justify_interval makes sure the sign bits on all three
fields months, days, and hours are all the same. After
the call, -24 < hours < 24 AND -30 < days < 30.
'make check' passes all tests. There are no tests for justify_interval, as it
is new. But the existing tests for justify_hours and justify_days appear to
still work, even though the behavior has changed. Apparently, their test cases
are not sensitive to the particular changes that have occurred.
I would include new tests in the patch but do not know on which reference
machine/platform the patches are supposed to be generated.
mark
Attachment | Content-Type | Size |
---|---|---|
patch | text/plain | 5.1 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Andrew Dunstan | 2006-03-03 20:35:24 | Re: drop if exists remainder |
Previous Message | Alvaro Herrera | 2006-03-03 20:12:55 | Re: Foreign keys for non-default datatypes |
From | Date | Subject | |
---|---|---|---|
Next Message | Andrew Dunstan | 2006-03-03 20:35:24 | Re: drop if exists remainder |
Previous Message | Jonah H. Harris | 2006-03-03 20:01:50 | Re: INS/UPD/DEL RETURNING for 8.2 |
From | Date | Subject | |
---|---|---|---|
Next Message | Davidson, Robert | 2006-03-04 00:13:04 | Getting yyyy-mm-dd 00:00:00 in an arbitrary time zone |
Previous Message | Scott Marlowe | 2006-03-03 20:15:31 | Re: pg_dump and diffrent sizes |