X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id F0CC052B6C for ; Mon, 1 Aug 2005 14:09:21 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 57555-10 for ; Mon, 1 Aug 2005 17:09:19 +0000 (GMT) Received: from larry.aptalaska.net (larry.aptalaska.net [64.186.96.3]) by svr1.postgresql.org (Postfix) with ESMTP id 61CF752B53 for ; Mon, 1 Aug 2005 14:09:18 -0300 (ADT) Received: from [192.168.98.9] (rdbck-static-287.palmer.mtaonline.net [64.4.232.33]) (authenticated bits=0) by larry.aptalaska.net (8.13.4/8.13.4) with ESMTP id j71HMx7V014924 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Mon, 1 Aug 2005 09:23:00 -0800 Message-ID: <42EE5720.2020306@aptalaska.net> Date: Mon, 01 Aug 2005 09:08:48 -0800 From: Matthew Schumacher User-Agent: Mozilla Thunderbird 1.0.2 (X11/20050317) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Tom Lane Cc: Michael Parker , pgsql-performance@postgresql.org Subject: Re: Performance problems testing with Spamassassin 3.1.0 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> In-Reply-To: <24657.1122872002@sss.pgh.pa.us> X-Enigmail-Version: 0.91.0.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Spam-Bayes: Learn: unavailable X-Scanned-By: MIMEDefang 2.52 on 64.186.96.3 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.008 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200508/5 X-Sequence-Number: 13752 Tom Lane wrote: > Michael Parker 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