Re: Date precision problem - Mailing list pgsql-general

From Hiroshi Inoue
Subject Re: Date precision problem
Date
Msg-id 3CBE43FA.CE387374@tpf.co.jp
Whole thread Raw
In response to Date precision problem  (noy <noyda@isoco.com>)
List 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 by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: Doc error? was: Why does this not work? (keyword 'TEXT')
Next
From: Bruce Momjian
Date:
Subject: Re: Critical performance problems on large databases