Re: BUG #1598: using default 'now', or now() or CURRENT_TIMESTAMP

From: Stephan Szabo <sszabo(at)megazone(dot)bigpanda(dot)com>
To: Nicolas HAHN <hahnn(at)x-itools(dot)com>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #1598: using default 'now', or now() or CURRENT_TIMESTAMP
Date: 2005-04-15 14:56:43
Message-ID: 20050415075351.R14377@megazone.bigpanda.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs


On Fri, 15 Apr 2005, Nicolas HAHN wrote:

>
> The following bug has been logged online:
>
> Bug reference: 1598
> Logged by: Nicolas HAHN
> Email address: hahnn(at)x-itools(dot)com
> PostgreSQL version: 7.4.7
> Operating system: Fedora Core 3
> Description: using default 'now', or now() or CURRENT_TIMESTAMP when
> creating table does not work as expected
> Details:
>
> I read the doc and saw that, to avoid the problem of using a default 'now'
> when creating the table which makes each record to have the timestamp of
> when the table has been created, default now() or default CURRENT_TIMESTAMP
> must be used instead. But using this is exactly the same as using 'now': I
> still get the same timestamp for each record I insert in the table.

now() is transaction start time and as such isn't going to vary within one
transaction, no matter how long you wait. The issue is what happens when
you commit the first transaction and start another and insert and whether
you get the transaction start time of the first transaction or the second.

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Richard Huxton 2005-04-15 15:13:10 Re: BUG #1598: using default 'now', or now() or CURRENT_TIMESTAMP
Previous Message Nicolas HAHN 2005-04-15 12:18:49 BUG #1598: using default 'now', or now() or CURRENT_TIMESTAMP when creating table does not work as expected