Re: [SQL] CURRENT_TIMSTAMP - Mailing list pgsql-admin

From Joel Burton
Subject Re: [SQL] CURRENT_TIMSTAMP
Date
Msg-id 20021202183827.GB12953@temp.joelburton.com
Whole thread Raw
List pgsql-admin
On Mon, Dec 02, 2002 at 11:41:33AM -0500, Raymond Chui wrote:
> I created a column, dada type timstamp with time zone
> and with default CURRENT_TIMSTAMP
> it shows me the default is
>
> default ('now'::text)::timstamp(6) with time zone
>
> Then when I insert a row, the default timestamp value is
>
> yyyy-mm-dd HH:MM:ss.mmmmm+00
>
> where mmmmm is milliseconds.
> How do I make default only yyyy-mm-dd HH:MM:ss+00 ?
> Thank Q!

The problem isn't CURRENT_TIMESTAMP, it's your table definition.
If you create the field as timestamp(0) [in 7.3, that's timestamp(0)
with time zone, since the default has swung to no-TZ], it will keep
track of just HMS. Or put in other values for 0 for more granularity on
seconds.

Of course, you can always store the specific time and select it out
w/less resolution (using the time/date functions). In some cases, this
might be a better solution.

- J.

--

Joel BURTON  |  joel@joelburton.com  |  joelburton.com  |  aim: wjoelburton
Independent Knowledge Management Consultant

pgsql-admin by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: How to setup a cluster of postgresql databases?
Next
From: "Nick Fankhauser"
Date:
Subject: Re: pg_restore error: function plpgsql_call_handler already exists with same argument types