Re: Problems with PLPGSQL - Mailing list pgsql-general

From Tom Lane
Subject Re: Problems with PLPGSQL
Date
Msg-id 19411.1068130461@sss.pgh.pa.us
Whole thread Raw
In response to Re: Problems with PLPGSQL  (Richard Huxton <dev@archonet.com>)
List pgsql-general
Richard Huxton <dev@archonet.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

pgsql-general by date:

Previous
From: George Essig
Date:
Subject: Re: tsearch2 and gist index bloat
Next
From: "scott.marlowe"
Date:
Subject: Re: INSERT and UPDATE of ALLBALLS/INFINITY dates and MOVE