From: Matthew Schumacher <matt.s@aptalaska.net>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Michael Parker <parkerm@pobox.com>
Cc: pgsql-performance@postgresql.org
Subject: Re: Performance problems testing with Spamassassin 3.1.0
Date: Mon, 01 Aug 2005 09:08:48 -0800
Message-ID: <42EE5720.2020306@aptalaska.net> (raw)
In-Reply-To: <24657.1122872002@sss.pgh.pa.us>
References: <42E80C28.2040608@aptalaska.net>
<1122532023.25574.1.camel@localhost.localdomain>
<42E9749F.6000709@aptalaska.net>
<1122616211.5691.340.camel@lamb.mcmillan.net.nz>
<42EA6966.8090402@aptalaska.net>
<1122668371.5691.352.camel@lamb.mcmillan.net.nz>
<19405.1122670917@sss.pgh.pa.us>
<42EAA410.9010700@aptalaska.net>
<27897.1122748133@sss.pgh.pa.us>
<20050801040443.GA6527@mail.herk.net>
<24657.1122872002@sss.pgh.pa.us>
Tom Lane wrote:
> Michael Parker <parkerm@pobox.com> writes:
>
>>sub bytea_esc {
>> my ($str) = @_;
>> my $buf = "";
>> foreach my $char (split(//,$str)) {
>> if (ord($char) == 0) { $buf .= "\\\\000"; }
>> elsif (ord($char) == 39) { $buf .= "\\\\047"; }
>> elsif (ord($char) == 92) { $buf .= "\\\\134"; }
>> else { $buf .= $char; }
>> }
>> return $buf;
>>}
>
>
> Oh, I see the problem: you forgot to convert " to a backslash sequence.
>
> It would probably also be wise to convert anything >= 128 to a backslash
> sequence, so as to avoid any possible problems with multibyte character
> encodings. You wouldn't see this issue in a SQL_ASCII database, but I
> suspect it would rise up to bite you with other encoding settings.
>
> regards, tom lane
Here is some code that applies Toms Suggestions:
38c39,41
< if (ord($char) == 0) { $buf .= "\\\\000"; }
---
> if (ord($char) >= 128) { $buf .= "\\\\" . sprintf ("%lo",
ord($char)); }
> elsif (ord($char) == 0) { $buf .= "\\\\000"; }
> elsif (ord($char) == 34) { $buf .= "\\\\042"; }
But this begs the question, why not escape everything?
schu
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 using the --to and --cc options:
reply via email
To: pgsql-performance@postgresql.org
Cc: matt.s@aptalaska.net, tgl@sss.pgh.pa.us, parkerm@pobox.com
Subject: Re: Performance problems testing with Spamassassin 3.1.0
In-Reply-To: <42EE5720.2020306@aptalaska.net>
* 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