pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Karel Zak <zakkr@zf.jcu.cz>
To: Christoph Haller <ch@rodos.fzk.de>
Cc: pgsql-sql@postgresql.org
Subject: Re: now() does not change within a transaction
Date: Thu, 18 Apr 2002 14:41:34 +0200
Message-ID: <20020418144134.A16277@zf.jcu.cz> (raw)
In-Reply-To: <200204181204.OAA11703@rodos>
References: <200204181204.OAA11703@rodos>

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):

http://docs.linux.cz/PostgreSQL/functions-datetime.html#FUNCTIONS-DATETIME-CURRENT 

   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;
           timeofday
-------------------------------
 2002-04-18 14:39:36.459162+02

        Karel

-- 
 Karel Zak  <zakkr@zf.jcu.cz>
 http://home.zf.jcu.cz/~zakkr/
 
 C, PostgreSQL, PHP, WWW, http://docs.linux.cz, http://mape.jcu.cz



view thread (3+ messages)  latest in thread

Message-ID: <20020418144134.A16277@zf.jcu.cz>
Permalink:  ../20020418144134.A16277@zf.jcu.cz/
Also on:    postgresql.org/message-id/20020418144134.A16277@zf.jcu.cz

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: zakkr@zf.jcu.cz, ch@rodos.fzk.de
  Subject: Re: now() does not change within a transaction
  In-Reply-To: <20020418144134.A16277@zf.jcu.cz>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox