Re: [GENERAL] missing something obvious about intervals?

From: "Jim C(dot) Nasby" <jnasby(at)pervasive(dot)com>
To: Bruno Wolff III <bruno(at)wolff(dot)to>, Jim Buttafuoco <jim(at)contactbda(dot)com>, David Rysdam <drysdam(at)ll(dot)mit(dot)edu>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: [GENERAL] missing something obvious about intervals?
Date: 2005-12-13 03:39:46
Message-ID: 20051213033945.GS54639@pervasive.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-hackers

On Mon, Dec 12, 2005 at 12:34:45PM -0600, Bruno Wolff III wrote:
> You are better off doing a multiply. Something like:
> area=> select '2005-12-01'::date + 456.5 * '1 second'::interval;
> ?column?
> ------------------------
> 2005-12-01 00:07:36.50
> (1 row)

This comes up often enough that it's probably worth adding a built-in
function, especially if it's faster to do the multiply (though
presumably a built-in function could outperform both the multiply and
the more common (4.5::float || ' seconds')::interval form.
--
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

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Jim C. Nasby 2005-12-13 03:44:01 Re: Excessive vacuum times
Previous Message Jim C. Nasby 2005-12-13 03:36:27 Re: Quick hack: permissions generator

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2005-12-13 03:39:47 Re: 7.3 failure on platypus
Previous Message Tom Lane 2005-12-13 03:20:45 Re: How much expensive are row level statistics?