Обсуждение: escaping string in a function

Поиск
Список
Период
Сортировка

escaping string in a function

От
"Shuying Wang"
Дата:
Hi,

I'm trying to write a function that would the results of select 'foo'
. How do I
escape strings within a create function block?

Thanks,
Shuying

Re: escaping string in a function

От
"Shuying Wang"
Дата:
I think I should also add that I'm using PostgreSQL 7.3

On 3/2/06, Shuying Wang <wang.shuying.lists@gmail.com> wrote:
> Hi,
>
> I'm trying to write a function that would the results of select 'foo'
> . How do I
> escape strings within a create function block?
>
> Thanks,
> Shuying
>

Re: escaping string in a function

От
Michael Fuhr
Дата:
On Thu, Mar 02, 2006 at 02:24:09PM +1100, Shuying Wang wrote:
> I'm trying to write a function that would the results of select 'foo'.
> How do I escape strings within a create function block?

It's not clear what you're trying to do -- could you explain a
little more?  Does the following example help?

CREATE FUNCTION func() RETURNS text AS '
  SELECT ''foo''::text
' LANGUAGE sql IMMUTABLE;

--
Michael Fuhr