Re: Feature request - Add microsecond as a time unit for interval

From: "Jim C(dot) Nasby" <jnasby(at)pervasive(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: David Tulloh <david(dot)tulloh(at)anu(dot)edu(dot)au>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Feature request - Add microsecond as a time unit for interval
Date: 2006-02-09 18:52:23
Message-ID: 20060209185223.GO57845@pervasive.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, Feb 09, 2006 at 10:30:30AM -0500, Tom Lane wrote:
> David Tulloh <david(dot)tulloh(at)anu(dot)edu(dot)au> writes:
> > To insert microseconds I have to use the following line, ($1*0.000001 ||
> > ' seconds')::interval
>
> Actually, the preferred way to do that is to use the numeric-times-interval
> operator, eg
>
> regression=# select 7 * '0.000001 second'::interval;
> ?column?
> -----------------
> 00:00:00.000007
> (1 row)
>
> This generalizes to any scale factor you care to use, eg fortnights...
> so I don't see a pressing need to add microseconds.

Something that's always struck me about intervals in PostgreSQL is the
how obtuse it is to generate one. Is there some reasonable way we could
add support for something like interval('7 microseconds')? Or perhaps
seconds(0.000007)?
--
Jim C. Nasby, Sr. Engineering Consultant jnasby(at)pervasive(dot)com
Pervasive Software http://pervasive.com work: 512-231-6117
vcard: http://jim.nasby.net/pervasive.vcf cell: 512-569-9461

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Mark Woodward 2006-02-09 19:03:41 Re: PostgreSQL 8.0.6 crash
Previous Message Tom Lane 2006-02-09 18:39:57 Re: [HACKERS] Krb5 & multiple DB connections