Re: Problem with COPY in 8.0.3

Поиск
Список
Период
Сортировка
От Michael Fuhr
Тема Re: Problem with COPY in 8.0.3
Дата
Msg-id 20051012202632.GA50746@winnie.fuhr.org
обсуждение исходный текст
Ответ на Problem with COPY in 8.0.3  (Oliver Elphick <olly@bray-healthcare.com>)
Ответы Re: Problem with COPY in 8.0.3  (Tom Lane <tgl@sss.pgh.pa.us>)
Список 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 по дате отправления:

Предыдущее
От: Oliver Elphick
Дата:
Сообщение: Re: Problem with COPY in 8.0.3
Следующее
От: Michael Fuhr
Дата:
Сообщение: Re: Problem with COPY in 8.0.3