Re: Epoch to timestamp conversion function patch

From: Michael Glaesemann <grzm(at)myrealbox(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: PostgreSQL Patches <pgsql-patches(at)postgresql(dot)org>
Subject: Re: Epoch to timestamp conversion function patch
Date: 2004-08-05 05:42:49
Message-ID: 48FF7334-E6A2-11D8-8966-000A95C88220@myrealbox.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Responses

Browse pgsql-patches by date

  From Date Subject
Next Message Joe Conway 2004-08-05 06:01:06 Re: [BUGS] casting strings to multidimensional arrays yields strange
Previous Message Tom Lane 2004-08-05 04:19:40 Re: [BUGS] casting strings to multidimensional arrays yields strange results