Re: [SQL] CURRENT_TIMSTAMP

From: Joel Burton <joel(at)joelburton(dot)com>
To: Raymond Chui <raymond(dot)chui(at)noaa(dot)gov>
Cc: pgsql-general(at)postgresql(dot)org, pgsql-sql(at)postgresql(dot)org, pgsql-admin(at)postgresql(dot)org
Subject: Re: [SQL] CURRENT_TIMSTAMP
Date: 2002-12-02 18:38:27
Message-ID: 20021202183827.GB12953@temp.joelburton.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin pgsql-general pgsql-sql

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(at)joelburton(dot)com | joelburton.com | aim: wjoelburton
Independent Knowledge Management Consultant

In response to

Browse pgsql-admin by date

  From Date Subject
Next Message yudha 2002-12-02 19:47:15 Unable to automaticly load Postmaster.
Previous Message Bruce Momjian 2002-12-02 18:13:00 Re: How to setup a cluster of postgresql databases?

Browse pgsql-general by date

  From Date Subject
Next Message SZUCS Gábor 2002-12-02 18:48:13 Re: Arrays: determining size
Previous Message Felipe Schnack 2002-12-02 18:27:53 Re: RPMS for 7.3

Browse pgsql-sql by date

  From Date Subject
Next Message Dennis Björklund 2002-12-02 18:44:03 Re: Min and Max
Previous Message Raymond Chui 2002-12-02 16:41:33 CURRENT_TIMSTAMP