From: Ross J. Reedstrom <reedstrm@rice.edu>
To: pgsql-sql@postgresql.org
Subject: Re: [SQL] DEFAULT TEXT 'now'
Date: Wed, 24 Mar 1999 10:26:55 -0600
Message-ID: <36F9124F.E2460C2C@rice.edu> (raw)
References: <3.0.5.32.19990323155824.007fa8c0@pop.hipernet.com.br>
<87ogljz7kd.fsf@tolikus.hq.aaanet.ru>
Anatoly K. Lasareff wrote:
>
> >>>>> "RJLG" == Roberto Joao Lopes Garcia <roberto@mha.com.br> writes:
>
>> <snipped problem with using default 'now'>
> <snipped description of using now() instead>
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., <reedstrm@rice.edu>
NSBRI Research Scientist/Programmer
Computer and Information Technology Institute
Rice University, 6100 S. Main St., Houston, TX 77005
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 from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-sql@postgresql.org
Cc: reedstrm@rice.edu
Subject: Re: [SQL] DEFAULT TEXT 'now'
In-Reply-To: <36F9124F.E2460C2C@rice.edu>
References: <3.0.5.32.19990323155824.007fa8c0@pop.hipernet.com.br> <87ogljz7kd.fsf@tolikus.hq.aaanet.ru> <36F9124F.E2460C2C@rice.edu>
* 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