Re: Problem with COPY in 8.0.3 - Mailing list pgsql-bugs

From Michael Fuhr
Subject Re: Problem with COPY in 8.0.3
Date
Msg-id 20051012202632.GA50746@winnie.fuhr.org
Whole thread Raw
In response to Problem with COPY in 8.0.3  (Oliver Elphick <olly@bray-healthcare.com>)
Responses Re: Problem with COPY in 8.0.3
List pgsql-bugs
On Wed, Oct 12, 2005 at 08:23:15PM +0100, Oliver Elphick wrote:
> On Wed, 2005-10-12 at 12:13 -0600, Michael Fuhr wrote:
> > On another note, regarding the following:
> >
> > > invdate       | date                  | not null default ('now'::text)::date
> > > taxpoint      | date                  | not null default ('now'::text)::date
> >
> > Are you sure you want 'now'::text as a default, considering the
> > warning against it?
>
> I actually use CURRENT_DATE; that is what the system turns it into.

Ah yes, I see that now.  I generally use now(), so I hadn't noticed
that CURRENT_DATE and CURRENT_TIMESTAMP become 'now', whereas only
a literal 'now' is expanded at create time:

CREATE TABLE foo (
    d1  date NOT NULL DEFAULT now(),
    d2  date NOT NULL DEFAULT CURRENT_DATE,
    d3  date NOT NULL DEFAULT 'now'
);

\d foo
                  Table "public.foo"
 Column | Type |              Modifiers
--------+------+--------------------------------------
 d1     | date | not null default now()
 d2     | date | not null default ('now'::text)::date
 d3     | date | not null default '2005-10-12'::date

--
Michael Fuhr

pgsql-bugs by date:

Previous
From: Oliver Elphick
Date:
Subject: Re: Problem with COPY in 8.0.3
Next
From: Michael Fuhr
Date:
Subject: Re: Problem with COPY in 8.0.3