pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Jonathan Ellis <jellis@advocast.com>
Cc: pgsql-general@postgresql.org
Subject: Re: pltcl: missing close-brace
Date: Thu, 30 Nov 2000 23:46:18 -0500
Message-ID: <415.975645978@sss.pgh.pa.us> (raw)
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>

"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



view thread (2+ messages)

Message-ID: <415.975645978@sss.pgh.pa.us>
Permalink:  ../415.975645978@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/415.975645978@sss.pgh.pa.us

 · 

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: tgl@sss.pgh.pa.us, jellis@advocast.com, pgsql-general@postgresql.org
  Subject: Re: pltcl: missing close-brace
  In-Reply-To: <415.975645978@sss.pgh.pa.us>
  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> <415.975645978@sss.pgh.pa.us>

* 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