pg.ddx.io pgsql-admin@postgresql.org mailing list archive
help / color / mirror / Atom feedInterval Format
6+ messages / 3 participants
[nested] [flat]
* Interval Format
@ 2008-11-22 01:39 Zagato <zagato.gekko@gmail.com>
0 siblings, 2 replies; 6+ messages in thread
From: Zagato @ 2008-11-22 01:39 UTC (permalink / raw)
To: pgsql-general@postgresql.org
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__
^ permalink raw reply [nested|flat] 6+ messages in thread
* Interval Format
@ 2008-11-22 01:40 Zagato <zagato.gekko@gmail.com>
parent: Zagato <zagato.gekko@gmail.com>
1 sibling, 1 reply; 6+ messages in thread
From: Zagato @ 2008-11-22 01:40 UTC (permalink / raw)
To: pgsql-admin
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
^ permalink raw reply [nested|flat] 6+ messages in thread
* Re: Interval Format
@ 2008-11-22 01:56 Ron Mayer <rm_pg@cheapcomplexdevices.com>
parent: Zagato <zagato.gekko@gmail.com>
1 sibling, 1 reply; 6+ messages in thread
From: Ron Mayer @ 2008-11-22 01:56 UTC (permalink / raw)
To: Zagato <zagato.gekko@gmail.com>; +Cc: pgsql-general@postgresql.org
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
^ permalink raw reply [nested|flat] 6+ messages in thread
* Re: Interval Format
@ 2008-11-22 02:28 Zagato <zagato.gekko@gmail.com>
parent: Ron Mayer <rm_pg@cheapcomplexdevices.com>
0 siblings, 0 replies; 6+ messages in thread
From: Zagato @ 2008-11-22 02:28 UTC (permalink / raw)
To: Ron Mayer <rm_pg@cheapcomplexdevices.com>; +Cc: pgsql-general@postgresql.org
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
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 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
>>
>
>
^ permalink raw reply [nested|flat] 6+ messages in thread
* Re: Interval Format
@ 2008-11-22 05:45 Francois Figarola <francois.figarola@laposte.net>
parent: Zagato <zagato.gekko@gmail.com>
0 siblings, 1 reply; 6+ messages in thread
From: Francois Figarola @ 2008-11-22 05:45 UTC (permalink / raw)
To: Zagato <zagato.gekko@gmail.com>; +Cc: pgsql-admin
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hello,
Zagato a écrit :
> 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. <http://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)
If you really want your interval in normalized form (like days , hours
parts...)
with versions from 8.1 and newers, you must use the justify_* function :
|SELECT justify_hours('@ 32 hours'::INTERVAL);
will give you :
justify_hours
- ----------------
1 day 08:00:00
and
SELECT justify_days('45 days @ 32 hours'::INTERVAL);
give
justify_days
- ------------------------
1 mon 15 days 32:00:00
or global function
||SELECT justify_interval('45 days @ 32 hours'::INTERVAL);
will give
justify_interval
- ------------------------
1 mon 16 days 08:00:00
|
>
> 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
Hope it can helps !
>
> Alan Jairo Acosta
>
Regards, François Figarola.
- --
- ----------------------------
L'éducation, c'est un peu comme une maladie sexuellement transmissible.
Ca rend inapte à des tas de besognes, puis ça démange d'en faire
profiter les autres.
Terry Pratchett in "Le père Porcher" (coll. Les Annales du Disque-Monde).
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iEYEARECAAYFAkknnGMACgkQXRu8MjnlzXks1wCaA+RIqhPk5BuGJeJ/jTn24Sg1
OPcAn39TO8vBYRuWcBuyysPl6+L0cD4L
=3Ww3
-----END PGP SIGNATURE-----
^ permalink raw reply [nested|flat] 6+ messages in thread
* Re: Interval Format
@ 2008-11-22 06:08 Zagato <zagato.gekko@gmail.com>
parent: Francois Figarola <francois.figarola@laposte.net>
0 siblings, 0 replies; 6+ messages in thread
From: Zagato @ 2008-11-22 06:08 UTC (permalink / raw)
To: Francois Figarola <francois.figarola@laposte.net>; +Cc: pgsql-admin
Douh..... !!! Jejej... well i think that if not possible to use a some kind
of default_justify_inteval, then i will try to update my SQLs...
Thanks :D
Alan Jairo Acosta
On Sat, Nov 22, 2008 at 12:45 AM, Francois Figarola <
francois.figarola@laposte.net> wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Hello,
>
> Zagato a écrit :
> > 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. <http://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)
> If you really want your interval in normalized form (like days , hours
> parts...)
> with versions from 8.1 and newers, you must use the justify_* function :
>
> |SELECT justify_hours('@ 32 hours'::INTERVAL);
>
> will give you :
>
> justify_hours
> - ----------------
> 1 day 08:00:00
>
> and
>
> SELECT justify_days('45 days @ 32 hours'::INTERVAL);
>
> give
>
> justify_days
> - ------------------------
> 1 mon 15 days 32:00:00
>
> or global function
>
> ||SELECT justify_interval('45 days @ 32 hours'::INTERVAL);
>
> will give
>
> justify_interval
> - ------------------------
> 1 mon 16 days 08:00:00
>
> |
> >
> > 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
> Hope it can helps !
> >
> > Alan Jairo Acosta
> >
> Regards, François Figarola.
>
> - --
> - ----------------------------
>
> L'éducation, c'est un peu comme une maladie sexuellement transmissible.
> Ca rend inapte à des tas de besognes, puis ça démange d'en faire
> profiter les autres.
> Terry Pratchett in "Le père Porcher" (coll. Les Annales du Disque-Monde).
>
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.9 (GNU/Linux)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
>
> iEYEARECAAYFAkknnGMACgkQXRu8MjnlzXks1wCaA+RIqhPk5BuGJeJ/jTn24Sg1
> OPcAn39TO8vBYRuWcBuyysPl6+L0cD4L
> =3Ww3
> -----END PGP SIGNATURE-----
>
>
^ permalink raw reply [nested|flat] 6+ messages in thread
end of thread, other threads:[~2008-11-22 06:08 UTC | newest]
Thread overview: 6+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2008-11-22 01:39 Interval Format Zagato <zagato.gekko@gmail.com>
2008-11-22 01:40 ` Zagato <zagato.gekko@gmail.com>
2008-11-22 05:45 ` Francois Figarola <francois.figarola@laposte.net>
2008-11-22 06:08 ` Zagato <zagato.gekko@gmail.com>
2008-11-22 01:56 ` Ron Mayer <rm_pg@cheapcomplexdevices.com>
2008-11-22 02:28 ` Zagato <zagato.gekko@gmail.com>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox