Received: from cortex.unice.fr (root@cortex.unice.fr [134.59.53.1]) by hub.org (8.8.8/8.7.5) with ESMTP id CAA09094 for ; Wed, 10 Jun 1998 02:56:00 -0400 (EDT) Received: from unice.fr (cortex.unice.fr [134.59.53.1]) by cortex.unice.fr (8.8.5/8.8.5) with ESMTP id IAA12343; Wed, 10 Jun 1998 08:50:00 +0200 Sender: jerome@cortex.unice.fr Message-ID: <357E2C97.7FB98C3C@unice.fr> Date: Wed, 10 Jun 1998 06:49:59 +0000 From: Jerome ALET Reply-To: alet@unice.fr Organization: Faculte de Medecine de Nice X-Mailer: Mozilla 4.04 [en] (X11; I; Linux 2.0.33 sparc) MIME-Version: 1.0 To: Petter Reinholdtsen CC: pgsql-sql@postgresql.org Subject: Re: [SQL] Problems with default date 'now' References: <199806091619.SAA10905@sleeper.games.no> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Petter Reinholdtsen wrote: > > I have a table where I want the default value of a date field to be > todays date when I do insert. I have this table definition: > > CREATE TABLE testdate( > received date DEFAULT 'now', > info text NOT NULL > ); > > The problem is that the 'now' apparently is substituted when I create > the table, not when I insert into it. Is there another way to handle > this? This is on Linux RedHat 5.0 with PostgreSQL 6.2.1. > replace your field definition with this one: received_date DATE DEFAULT CURRENT_DATE it works fine. bye, Jerome ALET - alet@unice.fr - http://cortex.unice.fr/~jerome Faculte de Medecine de Nice - http://noe.unice.fr - Tel: 04 93 37 76 30 28 Avenue de Valombrose - 06107 NICE Cedex 2 - FRANCE