Re: I was spoiled by the MySQL timestamp field

Поиск
Список
Период
Сортировка
От Matthew Nuzum
Тема Re: I was spoiled by the MySQL timestamp field
Дата
Msg-id 009001c2c576$1ad848b0$6700a8c0@mattspc
обсуждение исходный текст
Ответ на Re: I was spoiled by the MySQL timestamp field  (Lincoln Yeoh <lyeoh@pop.jaring.my>)
Ответы Re: I was spoiled by the MySQL timestamp field  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-general
The difference is when now() gets interpreted into a date.  Someone
please correct me if I'm wrong...

If you create a table at 15:00 Jan 26, 2003 and you use an unquoted
now() as the default value for a field, then each record will have it's
default value as 15:00 Jan 26, 2003.

If you quote the now(), then the default value for each newly created
record will be now() which is interpreted at the moment the record is
created.

I've used different rdbms so please forgive me if I'm documenting the
characteristics of a different system.

--
Matthew Nuzum
www.bearfruit.org
cobalt@bearfruit.org


> -----Original Message-----
> From: Lincoln Yeoh [mailto:lyeoh@pop.jaring.my]
> Sent: Friday, January 24, 2003 4:47 AM
> To: Matthew Nuzum; 'Björn Metzdorf'; 'Alan T. Miller'; pgsql-
> general@postgresql.org
> Subject: Re: [GENERAL] I was spoiled by the MySQL timestamp field
>
> At 03:02 PM 1/23/03 -0500, Matthew Nuzum wrote:
>
> >One word of caution, I *think* you want quotes around the 'now()'
> >statement in your table definition. Otherwise your default value will
be
> >the instant the *table* was created, not the instant your insert
> >happened.
>
> Would plain: default 'now' work? If it does (it seems to), what is the
> difference?
>
> Link.


В списке pgsql-general по дате отправления:

Предыдущее
От: Iker Arizmendi
Дата:
Сообщение: Re: [RFC] libpq extensions - followup
Следующее
От: Bruce Momjian
Дата:
Сообщение: Re: Logging of queryies