diff options
author | Bruce Momjian | 2006-03-06 22:49:17 +0000 |
---|---|---|
committer | Bruce Momjian | 2006-03-06 22:49:17 +0000 |
commit | d69b163247f62895c72f5f412638e5bbf4ca858b (patch) | |
tree | 25d0cafedc22e1078ffbeaba0ae7010a10f95ca5 /src/test | |
parent | 19c21d115d221d9738afad142f2886dfd3cc40de (diff) |
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.
Mark Dilger
Diffstat (limited to 'src/test')
-rw-r--r-- | src/test/regress/expected/interval.out | 7 | ||||
-rw-r--r-- | src/test/regress/sql/interval.sql | 3 |
2 files changed, 10 insertions, 0 deletions
diff --git a/src/test/regress/expected/interval.out b/src/test/regress/expected/interval.out index d07dd3013dc..7a43e90d5db 100644 --- a/src/test/regress/expected/interval.out +++ b/src/test/regress/expected/interval.out @@ -241,3 +241,10 @@ SELECT justify_days(interval '6 months 36 days 5 hours 4 minutes 3 seconds') as @ 7 mons 6 days 5 hours 4 mins 3 secs (1 row) +-- test justify_interval() +SELECT justify_interval(interval '1 month -1 hour') as "1 month -1 hour"; + 1 month -1 hour +-------------------- + @ 29 days 23 hours +(1 row) + diff --git a/src/test/regress/sql/interval.sql b/src/test/regress/sql/interval.sql index 25e58659e7d..bc384d01212 100644 --- a/src/test/regress/sql/interval.sql +++ b/src/test/regress/sql/interval.sql @@ -76,3 +76,6 @@ select '4 millenniums 5 centuries 4 decades 1 year 4 months 4 days 17 minutes 31 SELECT justify_hours(interval '6 months 3 days 52 hours 3 minutes 2 seconds') as "6 mons 5 days 4 hours 3 mins 2 seconds"; SELECT justify_days(interval '6 months 36 days 5 hours 4 minutes 3 seconds') as "7 mons 6 days 5 hours 4 mins 3 seconds"; +-- test justify_interval() + +SELECT justify_interval(interval '1 month -1 hour') as "1 month -1 hour"; |