Re: I was spoiled by the MySQL timestamp field - Mailing list pgsql-general

From Matthew Nuzum
Subject Re: I was spoiled by the MySQL timestamp field
Date
Msg-id 009001c2c576$1ad848b0$6700a8c0@mattspc
Whole thread Raw
In response to Re: I was spoiled by the MySQL timestamp field  (Lincoln Yeoh <lyeoh@pop.jaring.my>)
Responses Re: I was spoiled by the MySQL timestamp field
List 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 by date:

Previous
From: Iker Arizmendi
Date:
Subject: Re: [RFC] libpq extensions - followup
Next
From: Bruce Momjian
Date:
Subject: Re: Logging of queryies