pltcl: missing close-brace - Mailing list pgsql-general

From Jonathan Ellis
Subject pltcl: missing close-brace
Date
Msg-id 005301c05b30$be4318c0$0d00a8c0@dsl.inconnect.com
Whole thread Raw
In response to Re: Can PostGreSQL handle 100 user database?  ("Brian C. Doyle" <bcdoyle@mindspring.com>)
Responses Re: pltcl: missing close-brace
List pgsql-general
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.)

The PL/TCL results:

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';

bf2'# bf2'# bf2'# bf2'# bf2'# CREATE

bf2=# select replace2('a b', ' ', 'c');
ERROR:  pltcl: missing close-brace

The plain tcl results:

#!/usr/bin/tcl

proc replace { 1 2 3 } {
    regsub -all {&} "$3" {\\\&} 3
    regsub -all {\\[0-9]} "$3" {\\\0} 3
    eval "regsub -all \{$2\} \{$1\} \{$3\} rval"
    return $rval
}

puts [replace "a b" " " "c"]

$ ./test.tcl
acb

Any idea what this error message means?

-Jonathan


pgsql-general by date:

Previous
From: Alex Pilosov
Date:
Subject: Re: Can PostGreSQL handle 100 user database?
Next
From: The Hermit Hacker
Date:
Subject: Re: Transaction logging