more on timestamps

From: Gregory Seidman <gss+pg(at)cs(dot)brown(dot)edu>
To: pgsql-general(at)postgresql(dot)org
Subject: more on timestamps
Date: 2002-06-08 01:38:15
Message-ID: 20020608013815.GA25607@jamaica.cs.brown.edu
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

Browse pgsql-general by date

  From Date Subject
Next Message Bruce Momjian 2002-06-08 02:04:07 Re: What popular, large commercial websites run
Previous Message Joseph Syjuco 2002-06-07 23:57:43 arrays as pgsql function parameters