Received: from sid.trust.ee (sid.trust.ee [194.204.23.180]) by hub.org (8.8.8/8.7.5) with ESMTP id EAA20842 for ; Thu, 11 Jun 1998 04:21:26 -0400 (EDT) Received: from trust.ee (bonk.trust.ee [194.204.23.190]) by sid.trust.ee (8.8.7/8.8.7) with ESMTP id LAA04198; Thu, 11 Jun 1998 11:21:25 +0300 Message-ID: <357F9271.D4F12B47@trust.ee> Date: Thu, 11 Jun 1998 11:16:49 +0300 From: Hannu Reply-To: hannu@trust.ee Organization: Trust-O-Matic OÜ X-Mailer: Mozilla 4.05 [en] (WinNT; I) MIME-Version: 1.0 To: Byron Nikolaidis CC: interfaces postgres Subject: Re: [INTERFACES] Re: M$-Access'97 and TIMESTAMPs References: <357ED903.265DF2DA@insightdist.com> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Byron Nikolaidis wrote: > > Krasnow, Greg wrote: > > > I haven't looked at DATETIME stuff, but does Postgres not have something > > similar to Oracle's SYSDATE? In Oracle you can set an Oracle DATE column to > > have a default of SYSDATE. This way Oracle can fill in the column at the > > time an insert is done. > > > > Yes, you are right, and I noticed Jose' earlier mail about this on the 'sql' > list. > > If you do: > > create table x (a timestamp DEFAULT CURRENT_TIMESTAMP, b varchar); > > It works AND it puts in the current time at INSERT of the new row. (I noticed > if you use CURRENT_TIME instead, you get the time you created the table at, for > every row, which is not very useful.) > > The only problem is that it doesn't change the value on an UPDATE! > > Any thoughts? Why not use the system column tmin for this purpose? hannu=> create table test(i int); CREATE hannu=> insert into test values(5); INSERT 17454 1 hannu=> select tmin,tmax,i from test; tmin |tmax |i -----------------------------+-------+- Thu Jun 11 11:12:17 1998 EEST|current|5 (1 row) hannu=> update test set i=2; UPDATE 1 hannu=> select tmin,tmax,i from test; tmin |tmax |i -----------------------------+-------+- Thu Jun 11 11:13:00 1998 EEST|current|2 (1 row) ------ Hannu