Re: How to reformat output of "age()" function

From: Francisco Olarte <folarte(at)peoplecall(dot)com>
To: Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>
Cc: David Gauthier <davegauthierpg(at)gmail(dot)com>, Postgres General <pgsql-general(at)postgresql(dot)org>
Subject: Re: How to reformat output of "age()" function
Date: 2019-09-12 15:18:31
Message-ID: CA+bJJbxK4OC5vNdANYK5Fy30K5dmfTWU3RJdaWENxvRuPx4r8Q@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Adrian:

On Thu, Sep 12, 2019 at 4:23 PM Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com> wrote:

> > pure_seconds_interval
> > -----------------------
> > 3923:00:00
> > (1 row)
> >
> > A third representation! which gives the same result for epoch, but I'm
> > not sure it does for arithmetic....( tested it, it does not )
> >
> > I thought substraction would give me that, clearly it does not ( both
> > give the same when using epoch, as lacking tz info it has to assume
> > something, and it seems to assume no dst changes ).
>
> See doc information above. It uses the SET timezone. See below for more
> information:

I know how to set the timezone and operate with it, and Iknow for the
purpose of calculating elapsed seconds ( minutes / hours ) both
approaches are the same. What I'm saying is you must take care on how
to define and calculate your intervals if you are going to add them to
TS directly, as an 86400 seconds one has the same epoch than a 1day
one, but they represent different things when being added to a tstz,
and I know that the difference depends on the current timezone.

I do a lot of these, working with phone calls to extract ring / talk
time from setup/connect/disconnect time, and I do not hit problems
because I never do interval arithmetic on elapsed times , its not a
problem if you are aware that there are "infinite" ways to represent
an epoch in an interval .

Francisco Olarte.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Ron 2019-09-12 15:59:07 Re: Web GUI for PG table ?
Previous Message David Gauthier 2019-09-12 14:56:21 Re: Web GUI for PG table ?