Skip site navigation (1) Skip section navigation (2)

Re: FW: Re: Part 1 of several - Converting a varchar to an interval

From: Rodrigo E(dot) De León Plicet <rdeleonp(at)gmail(dot)com>
To: Shawn <postgres(at)xmtservices(dot)net>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: FW: Re: Part 1 of several - Converting a varchar to an interval
Date: 2008-03-26 23:12:07
Message-ID: a55915760803261612n16a87064y6abca46a0cdc42f8@mail.gmail.com (view raw or flat)
Thread:
Lists: pgsql-sql
On Wed, Mar 26, 2008 at 5:45 PM, Shawn <postgres(at)xmtservices(dot)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;

In response to

Responses

pgsql-sql by date

Next:From: ShawnDate: 2008-03-26 23:41:38
Subject: Re: FW: Re: Part 1 of several - Converting a varchar to an interval
Previous:From: ShawnDate: 2008-03-26 22:45:53
Subject: Re: FW: Re: Part 1 of several - Converting a varchar to an interval

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group