pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Jonathan Ellis <jellis@advocast.com>
To: pgsql-general@postgresql.org
Subject: pltcl: missing close-brace
Date: Thu, 30 Nov 2000 17:50:47 -0700
Message-ID: <005301c05b30$be4318c0$0d00a8c0@dsl.inconnect.com> (raw)
References: <5.0.2.1.2.20001130113826.082b4ec0@pop.mindspring.com>
	<3A268A5C.91CB7353@wgcr.org>
	<14886.40191.455322.734798@onceler.kciLink.com>
	<017c01c05b05$5729dfa0$0d00a8c0@dsl.inconnect.com>
	<26096.975625542@sss.pgh.pa.us>

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




view thread (2+ messages)  latest in thread

Message-ID: <005301c05b30$be4318c0$0d00a8c0@dsl.inconnect.com>
Permalink:  ../005301c05b30$be4318c0$0d00a8c0@dsl.inconnect.com/
Also on:    postgresql.org/message-id/005301c05b30$be4318c0$0d00a8c0@dsl.inconnect.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-sql@postgresql.org
  Cc: jellis@advocast.com, pgsql-general@postgresql.org
  Subject: Re: pltcl: missing close-brace
  In-Reply-To: <005301c05b30$be4318c0$0d00a8c0@dsl.inconnect.com>
  References: <5.0.2.1.2.20001130113826.082b4ec0@pop.mindspring.com> <3A268A5C.91CB7353@wgcr.org> <14886.40191.455322.734798@onceler.kciLink.com> <017c01c05b05$5729dfa0$0d00a8c0@dsl.inconnect.com> <26096.975625542@sss.pgh.pa.us> <005301c05b30$be4318c0$0d00a8c0@dsl.inconnect.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox