Re: Epoch to timestamp conversion function patch - Mailing list pgsql-patches

From Michael Glaesemann
Subject Re: Epoch to timestamp conversion function patch
Date
Msg-id 48FF7334-E6A2-11D8-8966-000A95C88220@myrealbox.com
Whole thread Raw
In response to Re: Epoch to timestamp conversion function patch  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: Epoch to timestamp conversion function patch
List pgsql-patches
On Aug 5, 2004, at 2:03 AM, Tom Lane wrote:
> I'd suggest just one function epoch_to_timestamp that actually yields
> timestamptz, and then if casting the result to timestamp is needed
> it'll
> happen automatically.

That makes sense.

Chris mentioned the possibility of using the MySQL FROM_UNIXTIME()
syntax instead of making something new.

<http://dev.mysql.com/doc/mysql/en/Date_and_time_functions.html>

I haven't checked the SQL spec, but I suspect they don't specify this
function. Might be nice to make it consistent with another
implementation rather than making new syntax to do the same thing. I
don't know whether Oracle (or DB2?) might have similar functions that
might at some time in the future make their way into the spec. Skimming
through the Oracle documentation and searching for similar
functionality in DB2 and Oracle on the web leads me to think they
*don't* currently have a function to do this directly. Anyone familiar
with DB2 or Oracle know if this is in fact the case?

One drawback would be that people might expect additional
functionality. For example, MySQL FROM_UNIXTIME(integer) works
similarly to epoch_to_timestamp(double). However, there's also a
FROM_UNIXTIME(integer, format) function that I really don't think would
be needed. Using a different syntax would call attention to this
difference.

Another idea would be to overload TO_TIMESTAMP to take a single double
precision float parameter rather than two text parameters.

Michael Glaesemann
grzm myrealbox com


pgsql-patches by date:

Previous
From: Tom Lane
Date:
Subject: Re: [BUGS] casting strings to multidimensional arrays yields strange results
Next
From: Joe Conway
Date:
Subject: Re: [BUGS] casting strings to multidimensional arrays yields strange