Re: timestamps, formatting, and internals

Поиск
Список
Период
Сортировка
От Adrian Klaver
Тема Re: timestamps, formatting, and internals
Дата
Msg-id 4FC58107.5040805@gmail.com
обсуждение исходный текст
Ответ на Re: timestamps, formatting, and internals  (David Salisbury <salisbury@globe.gov>)
Ответы Re: timestamps, formatting, and internals  (Adrian Klaver <adrian.klaver@gmail.com>)
Список pgsql-general
On 05/29/2012 04:28 PM, David Salisbury wrote:
>
>
> On 5/27/12 12:25 AM, Jasen Betts wrote:
>> The query: "show integer_datetimes;" should return 'on' which means
>> timestamps are microsecond precision if it returns 'off' your database
>> was built with floating point timstamps and equality tests will be
>> unreliable,
>
> I find that rather interesting. I was told that I was losing microseconds
> when I extracted an epoch from the difference between two timestamps and
> casted
> that value to an integer. So if I have integer timestamps ( your case
> above )
> I get microseconds, but integer epochs is without microseconds?

test=> SELECT extract(epoch from(now() - (now() - interval '1.345577 sec')));
 date_part
-----------
  1.345577


test=> SELECT extract(epoch from(now() - (now() - interval '1.345577 sec')))::int;
 date_part
-----------
         1

An integer is an integer so you will lose all the fractional parts:)

>
> Thanks,
>
> -ds
>


--
Adrian Klaver
adrian.klaver@gmail.com

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

Предыдущее
От: Adrian Klaver
Дата:
Сообщение: Re: Export and import from one postgres server to another
Следующее
От: Alan Gutierrez
Дата:
Сообщение: Re: Escaping `psql --variable`