Re: Automatic date/time

From: Sean Davis <sdavis2(at)mail(dot)nih(dot)gov>
To: Joao Miguel Ferreira <jmf(at)estg(dot)ipvc(dot)pt>, <pgsql-novice(at)postgresql(dot)org>
Subject: Re: Automatic date/time
Date: 2006-03-13 11:32:35
Message-ID: C03AC283.7E86%sdavis2@mail.nih.gov
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

On 3/13/06 6:19 AM, "Joao Miguel Ferreira" <jmf(at)estg(dot)ipvc(dot)pt> wrote:

> Hello all,
>
> is it possible to have Pg automatically insert a Date or Time value on a
> record if the INSERT comand does not include one ?
>
> Something similar to AUTO INCREMENT for INTs ?!?!
>
> This way the program that does the INSERT wouldn't have to worry about
> the correct Date/Time value nor format....

Look at setting defaults and set the default to something like 'now()'.

Create table .... (

mydate date default 'now()',

);

Sean

In response to

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message John Christopher 2006-03-13 13:37:16 Re: Automatic date/time
Previous Message Joao Miguel Ferreira 2006-03-13 11:19:58 Automatic date/time