more on timestamps - Mailing list pgsql-general

From Gregory Seidman
Subject more on timestamps
Date
Msg-id 20020608013815.GA25607@jamaica.cs.brown.edu
Whole thread Raw
List pgsql-general
Okay, I've come to the conclusion that I can manipulate timestamps in
almost all the ways I'd like to. The only issue I have is insertion. I'd
like to be able to insert an epoch-based value directly into a timestamp
field. It seems like I should be able to do that, but:

timemanage=> create table testing ( field timestamp with time zone);
CREATE
timemanage=> insert into testing values(1021780800);
ERROR:  column "field" is of type 'timestamp with time zone' but expression is of type 'integer'
        You will need to rewrite or cast the expression

According to http://www.postgresql.org/idocs/index.php?typeconv-query.html
it looks like the existence of timestamptz(int) (or maybe it's double
precision...) should allow the insertion, but it doesn't. Is there any way
to get PostgreSQL to automatically coerce an int (or double) to a
timestamptz on insertion?

--Greg


pgsql-general by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: Non-linear Performance
Next
From: Bruce Momjian
Date:
Subject: Re: What popular, large commercial websites run