Re: to_timestamp overloaded to convert from Unix epoch

From: Michael Glaesemann <grzm(at)myrealbox(dot)com>
To: Christopher Kings-Lynne <chriskl(at)familyhealth(dot)com(dot)au>
Cc: PostgreSQL Patches <pgsql-patches(at)postgresql(dot)org>
Subject: Re: to_timestamp overloaded to convert from Unix epoch
Date: 2004-08-14 13:22:52
Message-ID: 0B680D42-EDF5-11D8-831D-000A95C88220@myrealbox.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-patches


On Aug 14, 2004, at 6:50 PM, Christopher Kings-Lynne wrote:

> Maybe you don't need to override to_timestamp, and you can just add a
> new code to the format string that to_timestamp understands, ie 'e' or
> something or 'u' that means 'unix timestamp'?

Thanks for looking at the code! I know people are really busy now with
8.0.0beta1.

Are you thinking something like to_timestamp(200120400,'unix')? One
thing that I was thinking about when looking at the docs is that the
other to_ functions (other than to_char) took first a text-based
argument, and then the format. This to_timestamp takes (or casts to) a
double.

I can see how it might be forward-looking to have two parameters in
case we wanted to convert from some other numeric-based timestamp to
timestamptz; just change the formatting parameter. Two things come time
mind:

(1) I can't think of an instance when someone has asked to convert from
some other numeric-based timestamp.

(2) If the day comes when we would want to add another conversion,
nothing prevents us from creating it (though retaining the
one-parameter version for backwards-compatibility might be a reason
against this).

Thoughts?

Michael Glaesemann
grzm myrealbox com

In response to

Responses

Browse pgsql-patches by date

  From Date Subject
Next Message Andrew Dunstan 2004-08-14 13:26:28 Re: [HACKERS] [Fwd: Re: [pgsql-hackers-win32] Import from Linux to
Previous Message Andrew Dunstan 2004-08-14 12:52:13 Re: [Fwd: Re: [pgsql-hackers-win32] Import from Linux to