Skip site navigation (1) Skip section navigation (2)

Re: now() does not change within a transaction

From: Karel Zak <zakkr(at)zf(dot)jcu(dot)cz>
To: Christoph Haller <ch(at)rodos(dot)fzk(dot)de>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: now() does not change within a transaction
Date: 2002-04-18 12:41:34
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-sql
On Thu, Apr 18, 2002 at 02:04:35PM +0000, Christoph Haller wrote:
> Hi pgsql-sql list, 
> I did some testing around tables using a column 
> timestamp with time zone not null default now(). 
> I have noticed a valuable feature: 
> As long as being inside a transaction initiated by 
> begin; 
> the return value of the now() function does not change. 
> Is this intended - as written in the documentation? 

 Sure. See (for example): 

   It is quite important to realize that CURRENT_TIMESTAMP and related
   functions all return the time as of the start of the current transaction;
   their values do not increment while a transaction is running. But
   timeofday() returns the actual current time.
test=# select timeofday()::timestamp;
 2002-04-18 14:39:36.459162+02


 Karel Zak  <zakkr(at)zf(dot)jcu(dot)cz>
 C, PostgreSQL, PHP, WWW,,

In response to

pgsql-sql by date

Next:From: Leif JensenDate: 2002-04-18 13:21:46
Subject: Re: [GENERAL] Migrating Oracle to PostgreSQL
Previous:From: fredrik.samuelssonDate: 2002-04-18 07:12:32

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group