Cast timestamptz to/from integer?

From: Chris Angelico <rosuav(at)gmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Cast timestamptz to/from integer?
Date: 2012-04-03 07:30:55
Message-ID: CAPTjJmr7dwfp-+5=yaULEBV5irjSmz86+FZT7qBLQ+ygRneg2Q@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

I work a lot with Unix times as integers, but would like to store them
in Postgres as 'timestamp(0) with time zone' for convenience and
readability. Unfortunately the syntax to translate between the two is
a little cumbersome, so I'm looking at hiding it away behind a
function - or a cast. However, the CREATE CAST docs say that I have to
be the owner of either the source or target types, which presumably
means I can't define a cast from timestamptz to int.

Is there a workaround for this?

Chris Angelico

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Bartosz Dmytrak 2012-04-03 09:08:13 Re: Please help me to take a look of the erros in my functions. Thanks.
Previous Message Greg Smith 2012-04-03 07:01:33 Re: oracle linux