X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 5BF4FD1BB79 for ; Thu, 6 Nov 2003 23:19:56 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 78014-04 for ; Thu, 6 Nov 2003 19:19:27 -0400 (AST) Received: from smtp.noos.fr (nan-smtp-20.noos.net [212.198.2.120]) by svr1.postgresql.org (Postfix) with ESMTP id CEFC7D1BB66 for ; Thu, 6 Nov 2003 19:19:23 -0400 (AST) Received: (qmail 27227 invoked by uid 0); 6 Nov 2003 23:19:25 -0000 Received: from unknown (HELO bigfoot.com) ([212.198.40.101]) (envelope-sender ) by 212.198.2.120 (qmail-ldap-1.03) with SMTP for ; 6 Nov 2003 23:19:25 -0000 Message-ID: <3FAAD6F0.4080907@bigfoot.com> Date: Fri, 07 Nov 2003 00:19:12 +0100 From: Gaetano Mendola User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.5) Gecko/20031013 Thunderbird/0.3 X-Accept-Language: en-us, en MIME-Version: 1.0 To: "pgsql-sql@postgresql.org" Subject: Re: Now() in a function References: In-Reply-To: Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200311/36 X-Sequence-Number: 15851 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