Re: pltcl: missing close-brace

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Jonathan Ellis" <jellis(at)advocast(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: pltcl: missing close-brace
Date: 2000-12-01 04:46:18
Message-ID: 415.975645978@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-sql

"Jonathan Ellis" <jellis(at)advocast(dot)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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message GH 2000-12-01 05:09:37 Re: Reading privileges
Previous Message Don Baccus 2000-12-01 01:57:44 Re: [HACKERS] Re: PHPBuilder article -- Postgres vs MySQL

Browse pgsql-sql by date

  From Date Subject
Next Message Tom Lane 2000-12-01 05:33:22 Re: [HACKERS] Re: Rules with Conditions: Bug, or Misunderstanding
Previous Message Mark Hollomon 2000-12-01 03:07:22 Re: Re: [SQL] Rules with Conditions: Bug, or Misunderstanding