Re: [HACKERS] getting at the actual int4 value of an abstime

Поиск
Список
Период
Сортировка
От jim@reptiles.org (Jim Mercer)
Тема Re: [HACKERS] getting at the actual int4 value of an abstime
Дата
Msg-id m11H5qY-00080YC@mailbox.reptiles.org
обсуждение исходный текст
Ответ на Re: [HACKERS] getting at the actual int4 value of an abstime  ("Ross J. Reedstrom" <reedstrm@wallace.ece.rice.edu>)
Ответы Re: [HACKERS] getting at the actual int4 value of an abstime  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
> test=> select timefield::int8 from timetest;
>      int8
> ---------
> 934931603
> 934931604
> 934931605
> (3 rows)

hmmm, as you did, i tried timefield::int4, and got the same results.
i hadn't tried timefield::int8.

i suspect this would be more efficient than date_part('epoch', timefield).

> What version of PostgreSQL, BTW? This is 6.5: int8 and numeric support got a
> lot better vs. 6.4

i am using 6.5, soon gonna upgrade to 6.5.1.

thanx, this will make my code much more efficient.

also, is there a reverse to this?

ie.  how does one inject unix time_t data into an abstime field.

i currently pass my raw data through a filter, which converts it
to 'yyyy-mm-dd HH:MM:SS'.

then i bring it in using: "COPY tb USING STDIN;"

it would be nice if i could do a batch of:
"INSERT INTO tb (time_t, data1, date2) VALUES (934931604, 'aa', 'bb');"

--
[ Jim Mercer    Reptilian Research      jim@reptiles.org   +1 416 410-5633 ]
[ The telephone, for those of you who  have forgotten, was a commonly used ]
[ communications technology in the days before electronic mail.            ]
[ They're still easy to find in most large cities. -- Nathaniel Borenstein ]

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

Предыдущее
От: "D'Arcy" "J.M." Cain
Дата:
Сообщение: Re: [HACKERS] Re: [CORE] Re: tomorrow
Следующее
От: Tom Lane
Дата:
Сообщение: Re: [HACKERS] Re: [CORE] Re: tomorrow