Re: stored procedure and timestamp - Mailing list pgsql-general

From Karel Zak
Subject Re: stored procedure and timestamp
Date
Msg-id 20010329113029.B19743@ara.zf.jcu.cz
Whole thread Raw
In response to stored procedure and timestamp  (Soma Interesting <dfunct@telus.net>)
List pgsql-general
On Wed, Mar 28, 2001 at 04:13:19PM -0800, Soma Interesting wrote:
> I have the following trigger/stored procedure:
>
> CREATE FUNCTION memb_num () RETURNS opaque AS '
>          BEGIN
>                  NEW.member_num := date_part(''epoch'', timestamp ''now'');
                                                                ^^^^^^^^^^

> "Cannot insert a duplicate key into unique index members_member_num_key"


 From docs:

   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.


 CURRENT_TIMESTAMP = now() = timestamp 'now'


                                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

pgsql-general by date:

Previous
From: Peter Mount
Date:
Subject: Re: Bug in PostgreSQL JDBC Drive.
Next
From: Peter Mount
Date:
Subject: Re: fastpath error?