Re: Defaulting a column to 'now'

From: Bricklen Anderson <banderson(at)presinet(dot)com>
To: Ken Winter <ken(at)sunward(dot)org>
Cc: PostgreSQL pg-sql list <pgsql-sql(at)postgresql(dot)org>
Subject: Re: Defaulting a column to 'now'
Date: 2005-12-14 18:15:08
Message-ID: 43A0612C.2010605@presinet.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Ken Winter wrote:
> How can a column’s default be set to ‘now’, meaning ‘now’ as of when
> each row is inserted?
>
>
>
> For example, here’s a snip of DDL:
>
>
>
> create table personal_data (…
>
> effective_date_and_time TIMESTAMP WITH TIME ZONE not null default 'now',…
>

try with now(), instead of now
...
effective_date_and_time TIMESTAMPTZ not null default now()...

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Tom Lane 2005-12-14 18:15:20 Re: Defaulting a column to 'now'
Previous Message Ken Winter 2005-12-14 18:10:50 Defaulting a column to 'now'