pg.ddx.io pgsql-admin@postgresql.org mailing list archive
help / color / mirror / Atom feedhow to get a number of seconds in some interval ?
11+ messages / 5 participants
[nested] [flat]
* how to get a number of seconds in some interval ?
@ 2008-05-12 13:44 Julius Tuskenis <julius@nsoft.lt>
2008-05-12 14:24 ` Re: how to get a number of seconds in some interval ? Achilleas Mantzios <achill@matrix.gatewaynet.com>
0 siblings, 1 reply; 11+ messages in thread
From: Julius Tuskenis @ 2008-05-12 13:44 UTC (permalink / raw)
To: pgsql-admin
Hello,
Is there a good method of knowing how mutch seconds does some interval
have?? I tried my_interval / (interval '1 second'), but there is no
operator interval / interval defines (I wonder why).
Is there a method to do so?
--
Julius Tuskenis
Programavimo skyriaus vadovas
UAB nSoft
mob. +37068233050
^ permalink raw reply [nested|flat] 11+ messages in thread
* Re: how to get a number of seconds in some interval ?
2008-05-12 13:44 how to get a number of seconds in some interval ? Julius Tuskenis <julius@nsoft.lt>
@ 2008-05-12 14:24 ` Achilleas Mantzios <achill@matrix.gatewaynet.com>
2008-05-12 15:01 ` Re: how to get a number of seconds in some interval ? Achilleas Mantzios <achill@matrix.gatewaynet.com>
0 siblings, 1 reply; 11+ messages in thread
From: Achilleas Mantzios @ 2008-05-12 14:24 UTC (permalink / raw)
To: pgsql-admin; +Cc: Julius Tuskenis <julius@nsoft.lt>
Στις Monday 12 May 2008 16:44:16 ο/η Julius Tuskenis έγραψε:
> Hello,
>
> Is there a good method of knowing how mutch seconds does some interval
> have?? I tried my_interval / (interval '1 second'), but there is no
> operator interval / interval defines (I wonder why).
> Is there a method to do so?
>
smth like
dynacom=# SELECT extract(epoch from '49 hours 0 mins 12 seconds'::interval);
> --
> Julius Tuskenis
> Programavimo skyriaus vadovas
> UAB nSoft
> mob. +37068233050
>
>
--
Achilleas Mantzios
^ permalink raw reply [nested|flat] 11+ messages in thread
* Re: how to get a number of seconds in some interval ?
2008-05-12 13:44 how to get a number of seconds in some interval ? Julius Tuskenis <julius@nsoft.lt>
2008-05-12 14:24 ` Re: how to get a number of seconds in some interval ? Achilleas Mantzios <achill@matrix.gatewaynet.com>
@ 2008-05-12 15:01 ` Achilleas Mantzios <achill@matrix.gatewaynet.com>
2008-05-12 15:09 ` Re: how to get a number of seconds in some interval ? Tom Lane <tgl@sss.pgh.pa.us>
0 siblings, 1 reply; 11+ messages in thread
From: Achilleas Mantzios @ 2008-05-12 15:01 UTC (permalink / raw)
To: Julius Tuskenis <julius@nsoft.lt>; pgsql-admin
Στις Monday 12 May 2008 17:32:39 ο/η Julius Tuskenis έγραψε:
> Thank you, Achilleas.
>
> do you know why division of intervals was not implemented? As I see it -
> there should be an easy way to do so. '1 hour 30 minutes' / '1 hour' =
> 1.5 .... Seems straight forward...
>
No idea why. However as you pose it,it makes sense.
>
> Achilleas Mantzios rašė:
> > Στις Monday 12 May 2008 16:44:16 ο/η Julius Tuskenis έγραψε:
> >
> >> Hello,
> >>
> >> Is there a good method of knowing how mutch seconds does some interval
> >> have?? I tried my_interval / (interval '1 second'), but there is no
> >> operator interval / interval defines (I wonder why).
> >> Is there a method to do so?
> >>
> >>
> > smth like
> > dynacom=# SELECT extract(epoch from '49 hours 0 mins 12 seconds'::interval);
> >
> >
> >> --
> >> Julius Tuskenis
> >> Programavimo skyriaus vadovas
> >> UAB nSoft
> >> mob. +37068233050
> >>
> >>
> >>
> >
> >
> >
> >
>
>
--
Achilleas Mantzios
^ permalink raw reply [nested|flat] 11+ messages in thread
* Re: how to get a number of seconds in some interval ?
2008-05-12 13:44 how to get a number of seconds in some interval ? Julius Tuskenis <julius@nsoft.lt>
2008-05-12 14:24 ` Re: how to get a number of seconds in some interval ? Achilleas Mantzios <achill@matrix.gatewaynet.com>
2008-05-12 15:01 ` Re: how to get a number of seconds in some interval ? Achilleas Mantzios <achill@matrix.gatewaynet.com>
@ 2008-05-12 15:09 ` Tom Lane <tgl@sss.pgh.pa.us>
2008-05-13 06:20 ` Re: how to get a number of seconds in some interval ? Julius Tuskenis <julius@nsoft.lt>
2008-05-13 06:56 ` Re: how to get a number of seconds in some interval ? Achilleas Mantzios <achill@matrix.gatewaynet.com>
0 siblings, 2 replies; 11+ messages in thread
From: Tom Lane @ 2008-05-12 15:09 UTC (permalink / raw)
To: Achilleas Mantzios <achill@matrix.gatewaynet.com>; +Cc: Julius Tuskenis <julius@nsoft.lt>; pgsql-admin
Achilleas Mantzios <achill@matrix.gatewaynet.com> writes:
> Στις Monday 12 May 2008 17:32:39 ο/η Julius Tuskenis έγραψε:
>> do you know why division of intervals was not implemented? As I see it -
>> there should be an easy way to do so. '1 hour 30 minutes' / '1 hour' =
>> 1.5 .... Seems straight forward...
>>
> No idea why. However as you pose it,it makes sense.
No, it doesn't really, because intervals contain multiple components.
What would you define as the result of
'1 month 1 hour' / '1 day'
bearing in mind that the number of days per month is not fixed, and
neither is the number of hours per day?
You can derive a number if you're willing to make arbitrary assumptions
about the relationships of the different units (as indeed extract(epoch)
does), but hard-wiring such assumptions into a basic arithmetic operator
doesn't seem like a good idea to me.
regards, tom lane
^ permalink raw reply [nested|flat] 11+ messages in thread
* Re: how to get a number of seconds in some interval ?
2008-05-12 13:44 how to get a number of seconds in some interval ? Julius Tuskenis <julius@nsoft.lt>
2008-05-12 14:24 ` Re: how to get a number of seconds in some interval ? Achilleas Mantzios <achill@matrix.gatewaynet.com>
2008-05-12 15:01 ` Re: how to get a number of seconds in some interval ? Achilleas Mantzios <achill@matrix.gatewaynet.com>
2008-05-12 15:09 ` Re: how to get a number of seconds in some interval ? Tom Lane <tgl@sss.pgh.pa.us>
@ 2008-05-13 06:20 ` Julius Tuskenis <julius@nsoft.lt>
1 sibling, 0 replies; 11+ messages in thread
From: Julius Tuskenis @ 2008-05-13 06:20 UTC (permalink / raw)
To: ; +Cc: pgsql-admin
Thank you, it's now clear to me.
Tom Lane rašė:
> Achilleas Mantzios <achill@matrix.gatewaynet.com> writes:
>
>> Στις Monday 12 May 2008 17:32:39 ο/η Julius Tuskenis έγραψε:
>>
>>> do you know why division of intervals was not implemented? As I see it -
>>> there should be an easy way to do so. '1 hour 30 minutes' / '1 hour' =
>>> 1.5 .... Seems straight forward...
>>>
>>>
>> No idea why. However as you pose it,it makes sense.
>>
>
> No, it doesn't really, because intervals contain multiple components.
> What would you define as the result of
> '1 month 1 hour' / '1 day'
> bearing in mind that the number of days per month is not fixed, and
> neither is the number of hours per day?
>
> You can derive a number if you're willing to make arbitrary assumptions
> about the relationships of the different units (as indeed extract(epoch)
> does), but hard-wiring such assumptions into a basic arithmetic operator
> doesn't seem like a good idea to me.
>
> regards, tom lane
>
>
--
Julius Tuskenis
Programavimo skyriaus vadovas
UAB nSoft
mob. +37068233050
^ permalink raw reply [nested|flat] 11+ messages in thread
* Re: how to get a number of seconds in some interval ?
2008-05-12 13:44 how to get a number of seconds in some interval ? Julius Tuskenis <julius@nsoft.lt>
2008-05-12 14:24 ` Re: how to get a number of seconds in some interval ? Achilleas Mantzios <achill@matrix.gatewaynet.com>
2008-05-12 15:01 ` Re: how to get a number of seconds in some interval ? Achilleas Mantzios <achill@matrix.gatewaynet.com>
2008-05-12 15:09 ` Re: how to get a number of seconds in some interval ? Tom Lane <tgl@sss.pgh.pa.us>
@ 2008-05-13 06:56 ` Achilleas Mantzios <achill@matrix.gatewaynet.com>
2008-05-13 08:22 ` Re: how to get a number of seconds in some interval ? Scott Marlowe <scott.marlowe@gmail.com>
2008-05-13 14:15 ` Re: how to get a number of seconds in some interval ? Tom Lane <tgl@sss.pgh.pa.us>
1 sibling, 2 replies; 11+ messages in thread
From: Achilleas Mantzios @ 2008-05-13 06:56 UTC (permalink / raw)
To: pgsql-admin; +Cc: Tom Lane <tgl@sss.pgh.pa.us>; Julius Tuskenis <julius@nsoft.lt>
Στις Monday 12 May 2008 18:09:11 ο/η Tom Lane έγραψε:
> Achilleas Mantzios <achill@matrix.gatewaynet.com> writes:
> > Στις Monday 12 May 2008 17:32:39 ο/η Julius Tuskenis έγραψε:
> >> do you know why division of intervals was not implemented? As I see it -
> >> there should be an easy way to do so. '1 hour 30 minutes' / '1 hour' =
> >> 1.5 .... Seems straight forward...
> >>
> > No idea why. However as you pose it,it makes sense.
>
> No, it doesn't really, because intervals contain multiple components.
> What would you define as the result of
> '1 month 1 hour' / '1 day'
> bearing in mind that the number of days per month is not fixed, and
> neither is the number of hours per day?
>
SELECT extract(epoch from '1 month'::interval)/(60*60*24) as "Days in 1 month interval";
Days in 1 month interval
--------------------------
30
(1 row)
So it seems that the arbitary assumption of (1 month=30 days, and 1 day = 24 hours) has already been made
in the extract function.
> You can derive a number if you're willing to make arbitrary assumptions
> about the relationships of the different units (as indeed extract(epoch)
> does), but hard-wiring such assumptions into a basic arithmetic operator
> doesn't seem like a good idea to me.
>
> regards, tom lane
>
--
Achilleas Mantzios
^ permalink raw reply [nested|flat] 11+ messages in thread
* Re: how to get a number of seconds in some interval ?
2008-05-12 13:44 how to get a number of seconds in some interval ? Julius Tuskenis <julius@nsoft.lt>
2008-05-12 14:24 ` Re: how to get a number of seconds in some interval ? Achilleas Mantzios <achill@matrix.gatewaynet.com>
2008-05-12 15:01 ` Re: how to get a number of seconds in some interval ? Achilleas Mantzios <achill@matrix.gatewaynet.com>
2008-05-12 15:09 ` Re: how to get a number of seconds in some interval ? Tom Lane <tgl@sss.pgh.pa.us>
2008-05-13 06:56 ` Re: how to get a number of seconds in some interval ? Achilleas Mantzios <achill@matrix.gatewaynet.com>
@ 2008-05-13 08:22 ` Scott Marlowe <scott.marlowe@gmail.com>
2008-05-13 08:41 ` Re: how to get a number of seconds in some interval ? Achilleas Mantzios <achill@matrix.gatewaynet.com>
2008-05-13 08:42 ` Re: how to get a number of seconds in some interval ? Shane Ambler <pgsql@Sheeky.Biz>
1 sibling, 2 replies; 11+ messages in thread
From: Scott Marlowe @ 2008-05-13 08:22 UTC (permalink / raw)
To: Achilleas Mantzios <achill@matrix.gatewaynet.com>; +Cc: pgsql-admin@postgresql.org, "Tom Lane" <tgl@sss.pgh.pa.us>; Julius Tuskenis <julius@nsoft.lt>
On Tue, May 13, 2008 at 12:56 AM, Achilleas Mantzios
<achill@matrix.gatewaynet.com> wrote:
> Óôéò Monday 12 May 2008 18:09:11 ï/ç Tom Lane Ýãñáøå:
>> Achilleas Mantzios <achill@matrix.gatewaynet.com> writes:
>> > Óôéò Monday 12 May 2008 17:32:39 ï/ç Julius Tuskenis Ýãñáøå:
>> >> do you know why division of intervals was not implemented? As I see it -
>> >> there should be an easy way to do so. '1 hour 30 minutes' / '1 hour' =
>> >> 1.5 .... Seems straight forward...
>> >>
>> > No idea why. However as you pose it,it makes sense.
>>
>> No, it doesn't really, because intervals contain multiple components.
>> What would you define as the result of
>> '1 month 1 hour' / '1 day'
>> bearing in mind that the number of days per month is not fixed, and
>> neither is the number of hours per day?
>>
>
> SELECT extract(epoch from '1 month'::interval)/(60*60*24) as "Days in 1 month interval";
> Days in 1 month interval
> --------------------------
> 30
> (1 row)
> So it seems that the arbitary assumption of (1 month=30 days, and 1 day = 24 hours) has already been made
> in the extract function.
True. But that's only because it doesn't have a date to work against.
If you run:
select '2007-02-01 12:00:00'::timestamp + '1 month'::interval;
you get: 2007-03-01 12:00:00
If you run:
select '2007-03-01 12:00:00'::timestamp + '1 month'::interval;
you get: 2007-04-01 12:00:00
Then, if we run:
select ('2007-03-01 12:00:00'::timestamp + '1 month'::interval) -
'2007-03-01 12:00:00'::timestamp;
we get: 31 days
But if we run:
select ('2007-02-01 12:00:00'::timestamp + '1 month'::interval) -
'2007-02-01 12:00:00'::timestamp;
we get: 28 days
So, I'm not sure how many days a month has.
But your point is valid that given no date to compare to, an interval
of 1 month gets translated to 30 days. I can also see a lot of people
showing up doing fancy interval math THEN wondering why it changes
when you put a timestamp in the middle of it.
^ permalink raw reply [nested|flat] 11+ messages in thread
* Re: how to get a number of seconds in some interval ?
2008-05-12 13:44 how to get a number of seconds in some interval ? Julius Tuskenis <julius@nsoft.lt>
2008-05-12 14:24 ` Re: how to get a number of seconds in some interval ? Achilleas Mantzios <achill@matrix.gatewaynet.com>
2008-05-12 15:01 ` Re: how to get a number of seconds in some interval ? Achilleas Mantzios <achill@matrix.gatewaynet.com>
2008-05-12 15:09 ` Re: how to get a number of seconds in some interval ? Tom Lane <tgl@sss.pgh.pa.us>
2008-05-13 06:56 ` Re: how to get a number of seconds in some interval ? Achilleas Mantzios <achill@matrix.gatewaynet.com>
2008-05-13 08:22 ` Re: how to get a number of seconds in some interval ? Scott Marlowe <scott.marlowe@gmail.com>
@ 2008-05-13 08:41 ` Achilleas Mantzios <achill@matrix.gatewaynet.com>
1 sibling, 0 replies; 11+ messages in thread
From: Achilleas Mantzios @ 2008-05-13 08:41 UTC (permalink / raw)
To: Scott Marlowe <scott.marlowe@gmail.com>; +Cc: pgsql-admin@postgresql.org, "Tom Lane" <tgl@sss.pgh.pa.us>; Julius Tuskenis <julius@nsoft.lt>
ΣÏÎ¹Ï Tuesday 13 May 2008 11:22:28 ο/η Scott Marlowe ÎγÏαÏε:
> On Tue, May 13, 2008 at 12:56 AM, Achilleas Mantzios
> <achill@matrix.gatewaynet.com> wrote:
> > Óôéò Monday 12 May 2008 18:09:11 ï/ç Tom Lane Ýãñáøå:
> >> Achilleas Mantzios <achill@matrix.gatewaynet.com> writes:
> >> > Óôéò Monday 12 May 2008 17:32:39 ï/ç Julius Tuskenis Ýãñáøå:
> >> >> do you know why division of intervals was not implemented? As I see it -
> >> >> there should be an easy way to do so. '1 hour 30 minutes' / '1 hour' =
> >> >> 1.5 .... Seems straight forward...
> >> >>
> >> > No idea why. However as you pose it,it makes sense.
> >>
> >> No, it doesn't really, because intervals contain multiple components.
> >> What would you define as the result of
> >> '1 month 1 hour' / '1 day'
> >> bearing in mind that the number of days per month is not fixed, and
> >> neither is the number of hours per day?
> >>
> >
> > SELECT extract(epoch from '1 month'::interval)/(60*60*24) as "Days in 1 month interval";
> > Days in 1 month interval
> > --------------------------
> > 30
> > (1 row)
> > So it seems that the arbitary assumption of (1 month=30 days, and 1 day = 24 hours) has already been made
> > in the extract function.
>
> True. But that's only because it doesn't have a date to work against.
> If you run:
>
> select '2007-02-01 12:00:00'::timestamp + '1 month'::interval;
> you get: 2007-03-01 12:00:00
>
> If you run:
> select '2007-03-01 12:00:00'::timestamp + '1 month'::interval;
> you get: 2007-04-01 12:00:00
>
> Then, if we run:
> select ('2007-03-01 12:00:00'::timestamp + '1 month'::interval) -
> '2007-03-01 12:00:00'::timestamp;
> we get: 31 days
>
> But if we run:
> select ('2007-02-01 12:00:00'::timestamp + '1 month'::interval) -
> '2007-02-01 12:00:00'::timestamp;
> we get: 28 days
>
> So, I'm not sure how many days a month has.
>
> But your point is valid that given no date to compare to, an interval
> of 1 month gets translated to 30 days. I can also see a lot of people
> showing up doing fancy interval math THEN wondering why it changes
> when you put a timestamp in the middle of it.
>
Thanx for this well written explanation!
--
Achilleas Mantzios
^ permalink raw reply [nested|flat] 11+ messages in thread
* Re: how to get a number of seconds in some interval ?
2008-05-12 13:44 how to get a number of seconds in some interval ? Julius Tuskenis <julius@nsoft.lt>
2008-05-12 14:24 ` Re: how to get a number of seconds in some interval ? Achilleas Mantzios <achill@matrix.gatewaynet.com>
2008-05-12 15:01 ` Re: how to get a number of seconds in some interval ? Achilleas Mantzios <achill@matrix.gatewaynet.com>
2008-05-12 15:09 ` Re: how to get a number of seconds in some interval ? Tom Lane <tgl@sss.pgh.pa.us>
2008-05-13 06:56 ` Re: how to get a number of seconds in some interval ? Achilleas Mantzios <achill@matrix.gatewaynet.com>
2008-05-13 08:22 ` Re: how to get a number of seconds in some interval ? Scott Marlowe <scott.marlowe@gmail.com>
@ 2008-05-13 08:42 ` Shane Ambler <pgsql@Sheeky.Biz>
2008-05-13 08:48 ` Re: how to get a number of seconds in some interval ? Scott Marlowe <scott.marlowe@gmail.com>
1 sibling, 1 reply; 11+ messages in thread
From: Shane Ambler @ 2008-05-13 08:42 UTC (permalink / raw)
To: Scott Marlowe <scott.marlowe@gmail.com>; +Cc: Achilleas Mantzios <achill@matrix.gatewaynet.com>; pgsql-admin@postgresql.org, Tom Lane <tgl@sss.pgh.pa.us>; Julius Tuskenis <julius@nsoft.lt>
Scott Marlowe wrote:
> True. But that's only because it doesn't have a date to work against.
> If you run:
>
> select '2007-02-01 12:00:00'::timestamp + '1 month'::interval;
> you get: 2007-03-01 12:00:00
>
> If you run:
> select '2007-03-01 12:00:00'::timestamp + '1 month'::interval;
> you get: 2007-04-01 12:00:00
>
> Then, if we run:
> select ('2007-03-01 12:00:00'::timestamp + '1 month'::interval) -
> '2007-03-01 12:00:00'::timestamp;
> we get: 31 days
>
> But if we run:
> select ('2007-02-01 12:00:00'::timestamp + '1 month'::interval) -
> '2007-02-01 12:00:00'::timestamp;
> we get: 28 days
>
> So, I'm not sure how many days a month has.
Try looking at a calendar.;-)
You will find that these are the exact days between the two dates. Feb
has 28 days, so 1st of feb plus 1 month puts you at 1st of march
march has 31 days so 1st of march plus 1 month puts you at 1st of april.
Try a leap year -
select ('2008-02-01 12:00:00'::timestamp + '1 month'::interval) -
'2008-02-01 12:00:00'::timestamp;
?column?
----------
29 days
(1 row)
--
Shane Ambler
pgSQL (at) Sheeky (dot) Biz
Get Sheeky @ http://Sheeky.Biz
^ permalink raw reply [nested|flat] 11+ messages in thread
* Re: how to get a number of seconds in some interval ?
2008-05-12 13:44 how to get a number of seconds in some interval ? Julius Tuskenis <julius@nsoft.lt>
2008-05-12 14:24 ` Re: how to get a number of seconds in some interval ? Achilleas Mantzios <achill@matrix.gatewaynet.com>
2008-05-12 15:01 ` Re: how to get a number of seconds in some interval ? Achilleas Mantzios <achill@matrix.gatewaynet.com>
2008-05-12 15:09 ` Re: how to get a number of seconds in some interval ? Tom Lane <tgl@sss.pgh.pa.us>
2008-05-13 06:56 ` Re: how to get a number of seconds in some interval ? Achilleas Mantzios <achill@matrix.gatewaynet.com>
2008-05-13 08:22 ` Re: how to get a number of seconds in some interval ? Scott Marlowe <scott.marlowe@gmail.com>
2008-05-13 08:42 ` Re: how to get a number of seconds in some interval ? Shane Ambler <pgsql@Sheeky.Biz>
@ 2008-05-13 08:48 ` Scott Marlowe <scott.marlowe@gmail.com>
0 siblings, 0 replies; 11+ messages in thread
From: Scott Marlowe @ 2008-05-13 08:48 UTC (permalink / raw)
To: Shane Ambler <pgsql@sheeky.biz>; +Cc: Achilleas Mantzios <achill@matrix.gatewaynet.com>; pgsql-admin@postgresql.org, "Tom Lane" <tgl@sss.pgh.pa.us>; Julius Tuskenis <julius@nsoft.lt>
On Tue, May 13, 2008 at 2:42 AM, Shane Ambler <pgsql@sheeky.biz> wrote:
> Scott Marlowe wrote:
>
>> True. But that's only because it doesn't have a date to work against.
>> If you run:
>>
>> select '2007-02-01 12:00:00'::timestamp + '1 month'::interval;
>> you get: 2007-03-01 12:00:00
>>
>> If you run:
>> select '2007-03-01 12:00:00'::timestamp + '1 month'::interval;
>> you get: 2007-04-01 12:00:00
>>
>> Then, if we run:
>> select ('2007-03-01 12:00:00'::timestamp + '1 month'::interval) -
>> '2007-03-01 12:00:00'::timestamp;
>> we get: 31 days
>>
>> But if we run:
>> select ('2007-02-01 12:00:00'::timestamp + '1 month'::interval) -
>> '2007-02-01 12:00:00'::timestamp;
>> we get: 28 days
>>
>> So, I'm not sure how many days a month has.
>
> Try looking at a calendar.;-)
Sorry, didn't realize I'd need to explain my joke. Thought it was
pretty obvious. Next time I'll throw a smiley in there.
^ permalink raw reply [nested|flat] 11+ messages in thread
* Re: how to get a number of seconds in some interval ?
2008-05-12 13:44 how to get a number of seconds in some interval ? Julius Tuskenis <julius@nsoft.lt>
2008-05-12 14:24 ` Re: how to get a number of seconds in some interval ? Achilleas Mantzios <achill@matrix.gatewaynet.com>
2008-05-12 15:01 ` Re: how to get a number of seconds in some interval ? Achilleas Mantzios <achill@matrix.gatewaynet.com>
2008-05-12 15:09 ` Re: how to get a number of seconds in some interval ? Tom Lane <tgl@sss.pgh.pa.us>
2008-05-13 06:56 ` Re: how to get a number of seconds in some interval ? Achilleas Mantzios <achill@matrix.gatewaynet.com>
@ 2008-05-13 14:15 ` Tom Lane <tgl@sss.pgh.pa.us>
1 sibling, 0 replies; 11+ messages in thread
From: Tom Lane @ 2008-05-13 14:15 UTC (permalink / raw)
To: Achilleas Mantzios <achill@matrix.gatewaynet.com>; +Cc: pgsql-admin@postgresql.org, Julius Tuskenis <julius@nsoft.lt>
Achilleas Mantzios <achill@matrix.gatewaynet.com> writes:
> So it seems that the arbitary assumption of (1 month=30 days, and 1 day = 24 hours) has already been made in the extract function.
Right, as I said:
>> You can derive a number if you're willing to make arbitrary assumptions
>> about the relationships of the different units (as indeed extract(epoch)
>> does),
The point is that we don't want to propagate that bogus assumption
further than we have to. EXTRACT() already implies loss of information,
so it's reasonable for it to deliver a simplified view of reality, but
it doesn't follow that division should.
regards, tom lane
^ permalink raw reply [nested|flat] 11+ messages in thread
end of thread, other threads:[~2008-05-13 14:15 UTC | newest]
Thread overview: 11+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2008-05-12 13:44 how to get a number of seconds in some interval ? Julius Tuskenis <julius@nsoft.lt>
2008-05-12 14:24 ` Achilleas Mantzios <achill@matrix.gatewaynet.com>
2008-05-12 15:01 ` Achilleas Mantzios <achill@matrix.gatewaynet.com>
2008-05-12 15:09 ` Tom Lane <tgl@sss.pgh.pa.us>
2008-05-13 06:20 ` Julius Tuskenis <julius@nsoft.lt>
2008-05-13 06:56 ` Achilleas Mantzios <achill@matrix.gatewaynet.com>
2008-05-13 08:22 ` Scott Marlowe <scott.marlowe@gmail.com>
2008-05-13 08:41 ` Achilleas Mantzios <achill@matrix.gatewaynet.com>
2008-05-13 08:42 ` Shane Ambler <pgsql@Sheeky.Biz>
2008-05-13 08:48 ` Scott Marlowe <scott.marlowe@gmail.com>
2008-05-13 14:15 ` Tom Lane <tgl@sss.pgh.pa.us>
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