Re: FW: Re: Part 1 of several - Converting a varchar to an interval - Mailing list pgsql-sql

From Rodrigo E. De León Plicet
Subject Re: FW: Re: Part 1 of several - Converting a varchar to an interval
Date
Msg-id a55915760803261612n16a87064y6abca46a0cdc42f8@mail.gmail.com
Whole thread Raw
In response to Re: FW: Re: Part 1 of several - Converting a varchar to an interval  (Shawn <postgres@xmtservices.net>)
Responses Re: FW: Re: Part 1 of several - Converting a varchar to an interval
List pgsql-sql
On Wed, Mar 26, 2008 at 5:45 PM, Shawn <postgres@xmtservices.net> wrote:
>  obviously it doesn't like the extra single quotes around the 1 msec.  Any
>  suggestions for a work around?

Use dollar quoting, e.g.:

create or replace function dur_interval_msec(int) returns interval
as
$$
select ($1 * interval '1 msec');
$$
language sql
immutable
returns null on null input;


pgsql-sql by date:

Previous
From: Shawn
Date:
Subject: Re: FW: Re: Part 1 of several - Converting a varchar to an interval
Next
From: Shawn
Date:
Subject: Re: FW: Re: Part 1 of several - Converting a varchar to an interval