Christopher Kings-Lynne <[EMAIL PROTECTED]> writes:
> Whoops:
> SELECT 1070430858::abstime::timestamp;

Or you can do

  SELECT '1070430858'::int4::abstime::timestamp;

which helps expose the fact that you're really depending on the
int4-to-abstime binary equivalence.  This will certainly break in

The originally proposed documentation patch is flat wrong:

  SELECT 'epoch'::timestamp + '1070430858 seconds'::interval;

because it will produce a timestamp without time zone, thus effectively
making the epoch be 1970-1-1 midnight local time.  But of course the
correct Unix epoch is 1970-1-1 midnight GMT.  So correct code is

  SELECT 'epoch'::timestamptz + '1070430858 seconds'::interval;

or you could use

  SELECT 'epoch'::timestamptz + 1070430858 * '1 second'::interval;

which has the advantage that it works without weird concatenation
pushups when the numeric value is coming from a variable.

                        regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
    (send "unregister YourEmailAddressHere" to [EMAIL PROTECTED])

Reply via email to