Re: Oddity with extract microseconds?

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Christopher Kings-Lynne <chriskl(at)familyhealth(dot)com(dot)au>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Oddity with extract microseconds?
Date: 2005-12-06 17:09:19
Message-ID: 200512061709.jB6H9JD16121@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Tom Lane wrote:
> Christopher Kings-Lynne <chriskl(at)familyhealth(dot)com(dot)au> writes:
> > OK, AndrewSN just pointed out that it's "documented" to work like that...
> > ...still seems bizarre...
>
> It seems reasonably consistent to me. extract() doesn't consider
> seconds and fractional seconds to be distinct fields: it's all one
> value. The milliseconds and microseconds options just shift the
> decimal place for you.

I think this illustrates the issue:

test=> SELECT date_part('microseconds', '00:00:01.33'::time);
date_part
-----------
1330000
(1 row)

test=> SELECT date_part('microseconds', '00:03:01.33'::time);
date_part
-----------
1330000
(1 row)

Why aren't 'minutes' considered too? Because they aren't 'seconds'.
Well, seconds aren't microseconds either.

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2005-12-06 17:19:58 Re: Oddity with extract microseconds?
Previous Message Tom Lane 2005-12-06 17:03:14 Re: Oddity with extract microseconds?