Re: converting PostgreSQ- timestamp to UNIX-timestamp ?

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: converting PostgreSQ- timestamp to UNIX-timestamp ?
Дата
Msg-id 4339.1063823156@sss.pgh.pa.us
обсуждение исходный текст
Ответ на converting PostgreSQ- timestamp to UNIX-timestamp ?  ("Cornelia Boenigk" <poppcorn@cornelia-boenigk.de>)
Список pgsql-general
"Cornelia Boenigk" <poppcorn@cornelia-boenigk.de> writes:
> To convert PostgreSQL timestmp to UNIX timestamp I use
> select ((today::abstime)::int4) from table ...
> In the documentation there is a notice that abstime shouldn't be used.
> Is there another way to convert?

"SELECT EXTRACT(EPOCH FROM timestamp)" is the recommended way to do it.

> Also I tried
> select timetz_hash(today) from table ..
> and got negative values for some timestamps. Does anybody know why?

Why not?  If the hash function didn't use all 32 available bits, I'd
think it faulty ...

            regards, tom lane

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

Предыдущее
От: jason dang
Дата:
Сообщение: Bug while installing in AIX 5.1
Следующее
От: "Daniel Schuchardt"
Дата:
Сообщение: Re: psql and blob