Re: Date precision problem

Поиск
Список
Период
Сортировка
От Hiroshi Inoue
Тема Re: Date precision problem
Дата
Msg-id 3CBE43FA.CE387374@tpf.co.jp
обсуждение исходный текст
Ответ на Date precision problem  (noy <noyda@isoco.com>)
Список pgsql-general
noy wrote:
>
> ----
>  8
> ----
> The row is updated succesfully.
>
>  select * from test;
>  id |      name       |          last_update
> ----+-----------------+-------------------------------
>   2 | name 2          | 2002-04-17 16:56:54+02
>   3 | name 3          | 2002-04-17 16:57:00+02
>   1 | name 1 update 3 | 2002-04-17 16:40:44.548177+02
> (3 rows)
>
> ----
>  9
> ----
> Try to update the same row from ACCESS again. And a rollback is made by Postgres
>
> DEBUG:  StartTransactionCommand
> DEBUG:  query: SELECT "test"."id" FROM "test"
> DEBUG:  ProcessQuery
> DEBUG:  CommitTransactionCommand
> DEBUG:  StartTransactionCommand
> DEBUG:  query: SELECT "id","name","last_update"  FROM "test"  WHERE "id" = 2 OR
> "id" = 3 OR "id" = 1 OR "id" = 1 OR "id" = 1 OR "id" = 1 OR "id" = 1 OR "id" = 1
> OR "id" = 1 OR "id" = 1
> DEBUG:  ProcessQuery
> DEBUG:  CommitTransactionCommand
> DEBUG:  StartTransactionCommand
> DEBUG:  query: SELECT "id","name","last_update"  FROM "test"  WHERE "id" = 1
> DEBUG:  ProcessQuery
> DEBUG:  CommitTransactionCommand
> DEBUG:  StartTransactionCommand
> DEBUG:  query: BEGIN
> DEBUG:  ProcessUtility: BEGIN
> DEBUG:  CommitTransactionCommand
> DEBUG:  StartTransactionCommand
> DEBUG:  query: UPDATE "test" SET "name"='name 1 update 4'  WHERE "id" = 1 AND
> "name" = 'name 1 update 3' AND "last_update" = '2002-04-17 16:40:44.548'
> DEBUG:  ProcessQuery
> DEBUG:  CommitTransactionCommand
> DEBUG:  StartTransactionCommand
> DEBUG:  query: ROLLBACK
> DEBUG:  ProcessUtility: ROLLBACK
> DEBUG:  CommitTransactionCommand

Oh probably I see your point.
How about changing the line
    new."last_update" = ''now'';
to
    new."last_update" = ''now''::timestamp(0);

or creating the last_update field as timestamp(0)
from the first ?

regards,
Hiroshi Inoue
    http://w2422.nsk.ne.jp/~inoue/

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

Предыдущее
От: Bruce Momjian
Дата:
Сообщение: Re: Doc error? was: Why does this not work? (keyword 'TEXT')
Следующее
От: Bruce Momjian
Дата:
Сообщение: Re: Critical performance problems on large databases