Received: from ece.rice.edu (ece.rice.edu [128.42.4.34]) by hub.org (8.9.2/8.9.1) with ESMTP id LAA50084 for ; Wed, 24 Mar 1999 11:26:57 -0500 (EST) (envelope-from reedstrm@rice.edu) Received: from rice.edu (wallace.ece.rice.edu [128.42.12.154]) by ece.rice.edu (8.9.0/8.9.0) with ESMTP id KAA17703 for ; Wed, 24 Mar 1999 10:26:55 -0600 (CST) Sender: reedstrm@ece.rice.edu Message-ID: <36F9124F.E2460C2C@rice.edu> Date: Wed, 24 Mar 1999 10:26:55 -0600 From: "Ross J. Reedstrom" Organization: NSBRI X-Mailer: Mozilla 4.06 [en] (X11; U; Linux 2.2.3-ac3 i686) MIME-Version: 1.0 To: pgsql-sql@postgresql.org Subject: Re: [SQL] DEFAULT TEXT 'now' References: <3.0.5.32.19990323155824.007fa8c0@pop.hipernet.com.br> <87ogljz7kd.fsf@tolikus.hq.aaanet.ru> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Anatoly K. Lasareff wrote: > > >>>>> "RJLG" == Roberto Joao Lopes Garcia writes: > >> > What version of postgresql are you all using? I tried RJLG's example code with 6.4.2, and it worked - I got different times at each insert, so the default 'now' was being calculated at insertion time, not table creation time. Here's what it looks like: test2=> \d conex Table = conex +----------------------------------+----------------------------------+-------+ | Field | Type | Length| +----------------------------------+----------------------------------+-------+ | id | int4 not null default nextval ( | 4 | | inicio | datetime default text 'now' | 8 | | ultimo | datetime default text 'now' | 8 | | ip | inet | var | +----------------------------------+----------------------------------+-------+ Index: conex_pkey test2=> select * from conex; id|inicio |ultimo | ip --+----------------------------+----------------------------+--------------- 1|Tue Mar 23 13:40:24 1999 CST|Tue Mar 23 13:40:24 1999 CST|200.200.200.200 2|Tue Mar 23 13:40:28 1999 CST|Tue Mar 23 13:40:28 1999 CST|200.200.200.202 3|Tue Mar 23 13:40:30 1999 CST|Tue Mar 23 13:40:30 1999 CST|200.200.200.203 4|Tue Mar 23 13:41:06 1999 CST|Tue Mar 23 13:41:06 1999 CST|200.200.200.203 5|Tue Mar 23 13:41:21 1999 CST|Tue Mar 23 13:41:21 1999 CST|200.200.200.205 (5 rows) test2=> ??? Ross -- Ross J. Reedstrom, Ph.D., NSBRI Research Scientist/Programmer Computer and Information Technology Institute Rice University, 6100 S. Main St., Houston, TX 77005