Thread: Interval Format
Hi everyone... im looking for some help with the interval format between two diferents versions of postgres....
I have instaled in my old server postgres 8.0.3 and in my new one postgres 8.3.5...
Everything in both looks works nice but i notice a little difference that is taking my crazy..
I have som SQL that in 8.0.3 do:
# SELECT '32 hours'::INTERVAL;
interval
-----------------
@ 1 day 8 hours
(1 row)
And in 8.3.5 do:
seg_veh2=# SELECT '@ 32 hours'::INTERVAL;
interval
------------
@ 32 hours
(1 row)
Why i unable to get my old style of interval, i really need to see the day part.... im using datestyle german in both.... im try with "SET IntervalStyle TO..." but i get this error:
ERROR: unrecognized configuration parameter "intervalstyle"
looking throw the forums i get that this new param its just for postgres 8.4...
So.. how can i recover my "days" part...
Any help it appreciate... thanks :D
Alan Jairo Acosta
--
Farewell.
http://www.youtube.com/zagatogekko
ruby << __EOF__
puts [ 111, 116, 97, 103, 97, 90 ].collect{|v| v.chr}.join.reverse
__EOF__
I have instaled in my old server postgres 8.0.3 and in my new one postgres 8.3.5...
Everything in both looks works nice but i notice a little difference that is taking my crazy..
I have som SQL that in 8.0.3 do:
# SELECT '32 hours'::INTERVAL;
interval
-----------------
@ 1 day 8 hours
(1 row)
And in 8.3.5 do:
seg_veh2=# SELECT '@ 32 hours'::INTERVAL;
interval
------------
@ 32 hours
(1 row)
Why i unable to get my old style of interval, i really need to see the day part.... im using datestyle german in both.... im try with "SET IntervalStyle TO..." but i get this error:
ERROR: unrecognized configuration parameter "intervalstyle"
looking throw the forums i get that this new param its just for postgres 8.4...
So.. how can i recover my "days" part...
Any help it appreciate... thanks :D
Alan Jairo Acosta
--
Farewell.
http://www.youtube.com/zagatogekko
ruby << __EOF__
puts [ 111, 116, 97, 103, 97, 90 ].collect{|v| v.chr}.join.reverse
__EOF__
Zagato wrote: > I have som SQL that in 8.0.3 do: > # SELECT '32 hours'::INTERVAL; > interval > ----------------- > @ 1 day 8 hours > > And in 8.3.5 do: > seg_veh2=# SELECT '@ 32 hours'::INTERVAL; > interval > ------------ > @ 32 hours > > Why i unable to get my old style of interval, i really need to see the > day part.... im using datestyle german in both.... im try with "SET > IntervalStyle TO..." but i get this error: Even IntervalStyle won't help you here; since recent releases consider the values "1 day 8 hours" as distinct from "32 hours" (because they are at certain times of the year in some timezones where days are 25 hours, etc). > So.. how can i recover my "days" part... If you tell it what time of year you are thinking of this trick can work: dish=# set datestyle to german; SET dish=# select '2001-01-01'::timestamp + (interval '32 hours') - '2001-01-01'::timestamp; ?column? ----------------- @ 1 day 8 hours (1 row) > > Any help it appreciate... thanks :D
Hi.. thanks for the answer.... well this work in the test sql, but this needs to rewrite all the SQL in my PHP application :-p Jejej... can i set a deatul time year in postgres.conf or with a single SET ... ?
Thanks..
Alan Acosta
Thanks..
Alan Acosta
On Fri, Nov 21, 2008 at 8:56 PM, Ron Mayer <rm_pg@cheapcomplexdevices.com> wrote:
Zagato wrote:I have som SQL that in 8.0.3 do:
# SELECT '32 hours'::INTERVAL;
interval
-----------------
@ 1 day 8 hoursAnd in 8.3.5 do:
seg_veh2=# SELECT '@ 32 hours'::INTERVAL;
interval
------------
@ 32 hoursWhy i unable to get my old style of interval, i really need to see the day part.... im using datestyle german in both.... im try with "SET IntervalStyle TO..." but i get this error:
Even IntervalStyle won't help you here; since recent releases consider
the values "1 day 8 hours" as distinct from "32 hours" (because
they are at certain times of the year in some timezones
where days are 25 hours, etc).If you tell it what time of year you are thinking of this trick can work:So.. how can i recover my "days" part...
dish=# set datestyle to german;
SET
dish=# select '2001-01-01'::timestamp + (interval '32 hours') - '2001-01-01'::timestamp;
?column?
-----------------
@ 1 day 8 hours
(1 row)Any help it appreciate... thanks :D