Re: BUG #1757: timestamp 'epoch' is not absolute - Mailing list pgsql-bugs

From Bennett, Steve
Subject Re: BUG #1757: timestamp 'epoch' is not absolute
Date
Msg-id 7F332A8009EE5D4CB62C87717A3498A10E49D25F@exchange-be1.lancs.ac.uk
Whole thread Raw
In response to BUG #1757: timestamp 'epoch' is not absolute  ("Steve Bennett" <S.Bennett@lancaster.ac.uk>)
List pgsql-bugs
=20
> > It appears that the timestamp 'epoch' is being interpreted as
> > relative to the local timezone, rather than being an absolute time.
>=20
> This is correct for timestamp ... you want timestamp with time zone.

Sorry, but that's dumb (IMHO). The unix epoch is not relative to the
local timezone.

I'm now using a function to convert from unix times to timestamps, since
the alternative is ugly and verbose even by SQL standards...

  create function epoch(integer)
    returns timestamp with time zone
    as 'select timestamp with time zone \'epoch\'
        + interval \'1 second\' * $1;'
    language sql immutable;

Is there a better way?

Steve.

pgsql-bugs by date:

Previous
From: "Jack"
Date:
Subject: BUG #1761: missing files
Next
From: "Matthew T. O'Connor"
Date:
Subject: Re: pg_autovacuum: short, wide tables