pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Jerome ALET <alet@unice.fr>
To: Petter Reinholdtsen <pere@td.org.uit.no>
Cc: pgsql-sql@postgresql.org
Subject: Re: [SQL] Problems with default date 'now'
Date: Wed, 10 Jun 1998 06:49:59 +0000
Message-ID: <357E2C97.7FB98C3C@unice.fr> (raw)
References: <199806091619.SAA10905@sleeper.games.no>

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



view thread (7+ messages)  latest in thread

Message-ID: <357E2C97.7FB98C3C@unice.fr>
Permalink:  ../357E2C97.7FB98C3C@unice.fr/
Also on:    postgresql.org/message-id/357E2C97.7FB98C3C@unice.fr

 · 

reply

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: alet@unice.fr, pere@td.org.uit.no
  Subject: Re: [SQL] Problems with default date 'now'
  In-Reply-To: <357E2C97.7FB98C3C@unice.fr>
  References: <199806091619.SAA10905@sleeper.games.no> <357E2C97.7FB98C3C@unice.fr>

* 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