From: | Jerome ALET <alet(at)unice(dot)fr> |
---|---|
To: | Petter Reinholdtsen <pere(at)td(dot)org(dot)uit(dot)no> |
Cc: | pgsql-sql(at)postgresql(dot)org |
Subject: | Re: [SQL] Problems with default date 'now' |
Date: | 1998-06-10 06:49:59 |
Message-ID: | 357E2C97.7FB98C3C@unice.fr |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
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(at)unice(dot)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
From | Date | Subject | |
---|---|---|---|
Next Message | Philippe LEWEST | 1998-06-10 07:31:33 | Creation of a class of tables |
Previous Message | Petter Reinholdtsen | 1998-06-09 16:19:49 | Problems with default date 'now' |