Re: to_timestamp overloaded to convert from Unix epoch - Mailing list pgsql-patches

From Michael Glaesemann
Subject Re: to_timestamp overloaded to convert from Unix epoch
Date
Msg-id 0B680D42-EDF5-11D8-831D-000A95C88220@myrealbox.com
Whole thread Raw
In response to Re: to_timestamp overloaded to convert from Unix epoch  (Christopher Kings-Lynne <chriskl@familyhealth.com.au>)
Responses Re: to_timestamp overloaded to convert from Unix epoch
List 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


pgsql-patches by date:

Previous
From: Andrew Dunstan
Date:
Subject: Re: [HACKERS] [Fwd: Re: [pgsql-hackers-win32] Import from Linux to
Next
From: Andrew Dunstan
Date:
Subject: Re: [HACKERS] [Fwd: Re: [pgsql-hackers-win32] Import from Linux to