Re: Date precision problem

From: Hiroshi Inoue <Inoue(at)tpf(dot)co(dot)jp>
To: noy <noyda(at)isoco(dot)com>
Cc: Thomas Lockhart <thomas(at)fourpalms(dot)org>, pgsql-general(at)postgresql(dot)org
Subject: Re: Date precision problem
Date: 2002-04-18 03:56:42
Message-ID: 3CBE43FA.CE387374@tpf.co.jp
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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/

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Bruce Momjian 2002-04-18 04:04:04 Re: Critical performance problems on large databases
Previous Message Bruce Momjian 2002-04-18 03:54:27 Re: Doc error? was: Why does this not work? (keyword 'TEXT')