Re: Unixtime (epoch) into timestamp?

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Unixtime (epoch) into timestamp?
Дата
Msg-id 20204.1033094673@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: Unixtime (epoch) into timestamp?  (Ericson Smith <eric@did-it.com>)
Список pgsql-general
Ericson Smith <eric@did-it.com> writes:
> Just added this handy little function to our catalog based on that
> answer:

> CREATE FUNCTION "fn_date"(int4) RETURNS timestamp with time zone AS
> 'DECLARE
> my_epoch ALIAS FOR $1;
> my_ret timestamp;
> BEGIN
>    SELECT INTO my_ret "timestamp"(my_epoch);
>    RETURN my_ret;
> END;' LANGUAGE 'plpgsql';

Better make that
     SELECT INTO my_ret "timestamptz"(my_epoch);
else it will break in 7.3 --- "timestamp" is going to start meaning
"timestamp without time zone", per SQL spec.  Likewise my_ret had
better be explicitly declared timestamptz or timestamp with time zone.
Otherwise looks good.

            regards, tom lane

В списке pgsql-general по дате отправления:

Предыдущее
От: Scott Chapman
Дата:
Сообщение: Re: SQL subquery to supply table name?
Следующее
От: Tom Lane
Дата:
Сообщение: Re: get date in binary number format