Re: Now() in a function

From: Gaetano Mendola <mendola(at)bigfoot(dot)com>
To: "pgsql-sql(at)postgresql(dot)org" <pgsql-sql(at)postgresql(dot)org>
Subject: Re: Now() in a function
Date: 2003-11-06 23:19:12
Message-ID: 3FAAD6F0.4080907@bigfoot.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

sTesting wrote:

> Hi,
>
> I have a big problem, i wrote a very long function that is taking so
> much time. inside this function i added few debugging steps to find
> which section is taking most of the time, but all the created records
> have the same time in them, the time where the fuction begins.
> I tried to different methods:
> INSERT INTO f_error (error_id, creation_date)
> VALUES (nextval(''s_f_error_id''), now());
>
> INSERT INTO f_error (error_id, creation_date)
> VALUES (nextval(''s_f_error_id''), ''now'');

now() give you the time when the transaction started,
so what you see is the intended behavior, in your case you must use:
timeofday().

Regards
Gaetano Mendola

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message chester c young 2003-11-07 00:39:14 off subject - pg web hosting
Previous Message sTesting 2003-11-06 22:43:17 Now() in a function