Re: pltcl: missing close-brace

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: pltcl: missing close-brace
Дата
Msg-id 415.975645978@sss.pgh.pa.us
обсуждение исходный текст
Ответ на pltcl: missing close-brace  ("Jonathan Ellis" <jellis@advocast.com>)
Список pgsql-general
"Jonathan Ellis" <jellis@advocast.com> writes:
> I have a pl/tcl function that doesn't work, but the same function in a
> plain-vanilla tcl script does.  (The function emulates Oracle's "replace"
> function.)

> bf2=# create function replace2 (varchar, varchar, varchar) returns varchar
> as '
>     regsub -all {&} "$3" {\\\&} 3
>     regsub -all {\\[0-9]} "$3" {\\\0} 3
>     eval "regsub -all \{$2\} \{$1\} \{$3\} rval"
>     return $rval
> ' language 'pltcl';

Those backslashes all need to be protected by backslashes ...
the SQL parser will strip off one level of backslashing as it parses
the command.

            regards, tom lane

В списке pgsql-general по дате отправления:

Предыдущее
От: Bernie Huang
Дата:
Сообщение: a script that queries database periodically
Следующее
От: GH
Дата:
Сообщение: Re: Reading privileges