Re: Problems with PLPGSQL

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Richard Huxton <dev(at)archonet(dot)com>
Cc: Alex <alex(at)meerkatsoft(dot)com>, pgsql-general(at)postgresql(dot)org
Subject: Re: Problems with PLPGSQL
Date: 2003-11-06 14:54:21
Message-ID: 19411.1068130461@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Richard Huxton <dev(at)archonet(dot)com> writes:
> On Thursday 06 November 2003 10:00, Alex wrote:
>> as for the timestamp, both ways work fine, but the other problem still
>> exists. using a
>> ''60 Min'' works just fine, but WHERE job_end + ($1::text || '' Min'' )

> You probably want a cast:
> + ($1::text || '' min'')::interval

This is pretty much the hard way, though. A better idea is to use the
number-times-interval operator:

timestampvalue + $1 * '1 min'::interval;

Easier to write and faster.

regards, tom lane

In response to

Browse pgsql-general by date

  From Date Subject
Next Message scott.marlowe 2003-11-06 15:00:06 Re: INSERT and UPDATE of ALLBALLS/INFINITY dates and MOVE
Previous Message George Essig 2003-11-06 14:52:13 Re: tsearch2 and gist index bloat