Skip Menu |
 
rt.cpan.org will be shut down on March 1st, 2021.

This queue is for tickets about the DBD-Pg CPAN distribution.

Report information
The Basics
Id: 40440
Status: rejected
Priority: 0/
Queue: DBD-Pg

People
Owner: Nobody in particular
Requestors: lpsolit [...] gmail.com
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



MIME-Version: 1.0
X-Spam-Status: No, hits=0.0 required=8.0 tests=DK_SIGNED,SPF_PASS
content-type: text/plain; charset="utf-8"
Received: from la.mx.develooper.com (x1.develooper.com [63.251.223.170]) by diesel.bestpractical.com (Postfix) with SMTP id 7BA7219B817D for <bug-DBD-Pg [...] rt.cpan.org>; Mon, 27 Oct 2008 20:40:22 -0400 (EDT)
Received: (qmail 16032 invoked by uid 103); 28 Oct 2008 00:40:21 -0000
Received: from x16.dev (10.0.100.26) by x1.dev with QMQP; 28 Oct 2008 00:40:21 -0000
Received: from ug-out-1314.google.com (HELO ug-out-1314.google.com) (66.249.92.168) by 16.mx.develooper.com (qpsmtpd/0.43rc1) with ESMTP; Mon, 27 Oct 2008 17:40:20 -0700
Received: by ug-out-1314.google.com with SMTP id j3so121300ugf.3 for <bug-DBD-Pg [...] rt.cpan.org>; Mon, 27 Oct 2008 17:40:14 -0700 (PDT)
Received: by 10.86.72.3 with SMTP id u3mr3883126fga.1.1225154414705; Mon, 27 Oct 2008 17:40:14 -0700 (PDT)
Received: from ?192.168.1.33? (43-255.76-83.cust.bluewin.ch [83.76.255.43]) by mx.google.com with ESMTPS id e20sm845960fga.1.2008.10.27.17.40.12 (version=TLSv1/SSLv3 cipher=RC4-MD5); Mon, 27 Oct 2008 17:40:13 -0700 (PDT)
Delivered-To: cpan-bug+DBD-Pg [...] diesel.bestpractical.com
User-Agent: Thunderbird 2.0.0.17 (X11/20080914)
Subject: DBI->quote(quotemeta("foo-bar")) returns invalid string
Return-Path: <lpsolit [...] gmail.com>
Domainkey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:user-agent:mime-version:to:subject :x-enigmail-version:content-type:content-transfer-encoding:from; b=bofLb/9uJOycAbkNeS7Ry2UihgdbziCFHVQUlxm18wvACh9fsj4mWTJLjCvgrdk7w3 PTaKGtImWBA9QK2z6Q38092vKBpNUm3PIIkc/wOdZIs9g6PAQveQ0iP6PuDGqTHBf2yz Y0QNPg1OFTrhwPdlP97x62vz9mLfBYrzgqFqc=
X-Original-To: bug-DBD-Pg [...] rt.cpan.org
X-Spam-Check-BY: 16.mx.develooper.com
Dkim-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:user-agent :mime-version:to:subject:x-enigmail-version:content-type :content-transfer-encoding:from; bh=kRWUrzw4KO8QuiakiugeHi5pY6xE6ZvJuBxJ4822d40=; b=nw0ggbH+oLbKW1seFQGEeCU9siFJVOmr8jmNFrOBHwZ4+aBRazmT2aDr8iuRsWL/Iy wNRS6dH+8JVz3fnyV6OHWcOJbM5n0jWMx2q+gmdMik8R8/mwhQtjQab+2k7XBFujfawL /p5u99uRRvYyJkLrqVJITfAuKbSUvdKe4Al/Y=
Date: Tue, 28 Oct 2008 01:40:11 +0100
X-Spam-Level: *
Message-Id: <49065F6B.2030609 [...] gmail.com>
To: bug-DBD-Pg [...] rt.cpan.org
X-Enigmail-Version: 0.95.7
Content-Transfer-Encoding: 7bit
From: Frédéric Buclin <lpsolit [...] gmail.com>
X-RT-Original-Encoding: ISO-8859-1
Content-Length: 409
Download (untitled) / with headers
text/plain 409b
While running the following command: perl -MBugzilla -e '$dbh = Bugzilla->dbh; print $dbh->quote(quotemeta("key-selenium-ktwo"))' it returns E'key\\-selenium\\-ktwo' instead of 'key\\-selenium\\-ktwo' when using either DBD::Pg 2.10.3 or 2.11.2. The problem doesn't occur with DBD::Pg 1.49. This generates invalid strings which, when used in SQL queries, generate crashes. I'm using Perl 5.10.0 on Linux.
MIME-Version: 1.0
In-Reply-To: <49065F6B.2030609 [...] gmail.com>
X-Mailer: MIME-tools 5.426 (Entity 5.426)
Content-Disposition: inline
Charset: utf8
References: <49065F6B.2030609 [...] gmail.com>
Message-Id: <rt-3.6.HEAD-11125-1225155533-1916.40440-0-0 [...] rt.cpan.org>
Content-Type: text/plain
Content-Transfer-Encoding: binary
X-RT-Original-Encoding: utf-8
Content-Length: 196
Download (untitled) / with headers
text/plain 196b
Why are you using quotemeta here? Please describe in detail what sort of crash occurs. You should in general be using placeholders, and not trying to construct queries from the output of quote().
MIME-Version: 1.0 (Apple Message framework v929.2)
X-Spam-Status: No, hits=0.0 required=8.0 tests=
In-Reply-To: <rt-3.6.HEAD-11125-1225155533-1916.40440-5-0 [...] rt.cpan.org>
X-Mailer: Apple Mail (2.929.2)
References: <RT-Ticket-40440 [...] rt.cpan.org> <49065F6B.2030609 [...] gmail.com> <rt-3.6.HEAD-11125-1225155533-1916.40440-5-0 [...] rt.cpan.org>
Content-Type: text/plain; charset="utf-8"; delsp="yes"; format="flowed"
X-RT-Original-Encoding: utf-8
Received: from la.mx.develooper.com (x1.develooper.com [63.251.223.170]) by diesel.bestpractical.com (Postfix) with SMTP id 1819919B817D for <bug-DBD-Pg [...] rt.cpan.org>; Mon, 27 Oct 2008 21:01:40 -0400 (EDT)
Received: (qmail 21428 invoked by uid 103); 28 Oct 2008 01:01:39 -0000
Received: from x16.dev (10.0.100.26) by x1.dev with QMQP; 28 Oct 2008 01:01:39 -0000
Received: from host-201.commandprompt.net (HELO smtp.kineticode.com) (207.173.203.201) by 16.mx.develooper.com (qpsmtpd/0.43rc1) with ESMTP; Mon, 27 Oct 2008 18:01:37 -0700
Received: from [192.168.1.104] (c-67-160-131-113.hsd1.or.comcast.net [67.160.131.113]) by smtp.kineticode.com (Postfix) with ESMTPSA id BCDF950805B for <bug-DBD-Pg [...] rt.cpan.org>; Mon, 27 Oct 2008 17:48:57 -0700 (PDT)
Delivered-To: cpan-bug+DBD-Pg [...] diesel.bestpractical.com
Subject: Re: [rt.cpan.org #40440] DBI->quote(quotemeta("foo-bar")) returns invalid string
Return-Path: <dwheeler [...] cpan.org>
X-Spam-Check-BY: 16.mx.develooper.com
X-Original-To: bug-DBD-Pg [...] rt.cpan.org
Date: Mon, 27 Oct 2008 18:01:33 -0700
X-Spam-Level: *
Message-Id: <183ED9BF-5677-4B79-AE13-786471644B85 [...] cpan.org>
To: bug-DBD-Pg [...] rt.cpan.org
Content-Transfer-Encoding: 7bit
From: "David E. Wheeler" <dwheeler [...] cpan.org>
RT-Message-ID: <rt-3.6.HEAD-11100-1225155704-1929.40440-0-0 [...] rt.cpan.org>
Content-Length: 375
Download (untitled) / with headers
text/plain 375b
On Oct 27, 2008, at 17:58, Greg Sabino Mullane via RT wrote: Show quoted text
> Why are you using quotemeta here? Please describe in detail what > sort of > crash occurs. You should in general be using placeholders, and not > trying to construct queries from the output of quote().
Also, what version of PostgreSQL are you using and against what version did you compile DBD::Pg? David
MIME-Version: 1.0
X-Spam-Status: No, hits=0.0 required=8.0 tests=DK_SIGNED,SPF_PASS
In-Reply-To: <rt-3.6.HEAD-11125-1225155533-1916.40440-6-0 [...] rt.cpan.org>
References: <RT-Ticket-40440 [...] rt.cpan.org> <49065F6B.2030609 [...] gmail.com> <rt-3.6.HEAD-11125-1225155533-1916.40440-6-0 [...] rt.cpan.org>
Content-Type: text/plain; charset=UTF-8
X-RT-Original-Encoding: utf-8
Received: from la.mx.develooper.com (x1.develooper.com [63.251.223.170]) by diesel.bestpractical.com (Postfix) with SMTP id 6EC8223C0DA for <bug-DBD-Pg [...] rt.cpan.org>; Tue, 28 Oct 2008 14:12:37 -0400 (EDT)
Received: (qmail 19657 invoked by uid 103); 28 Oct 2008 18:12:36 -0000
Received: from x16.dev (10.0.100.26) by x1.dev with QMQP; 28 Oct 2008 18:12:36 -0000
Received: from an-out-0708.google.com (HELO an-out-0708.google.com) (209.85.132.245) by 16.mx.develooper.com (qpsmtpd/0.43rc1) with ESMTP; Tue, 28 Oct 2008 11:12:32 -0700
Received: by an-out-0708.google.com with SMTP id b38so226614ana.16 for <bug-DBD-Pg [...] rt.cpan.org>; Tue, 28 Oct 2008 11:12:29 -0700 (PDT)
Received: by 10.103.11.7 with SMTP id o7mr3553990mui.103.1225217547718; Tue, 28 Oct 2008 11:12:27 -0700 (PDT)
Received: from ?192.168.1.33? (223-220.76-83.cust.bluewin.ch [83.76.220.223]) by mx.google.com with ESMTPS id y2sm7052284mug.2.2008.10.28.11.12.25 (version=TLSv1/SSLv3 cipher=RC4-MD5); Tue, 28 Oct 2008 11:12:26 -0700 (PDT)
Delivered-To: cpan-bug+DBD-Pg [...] diesel.bestpractical.com
Subject: Re: [rt.cpan.org #40440] DBI->quote(quotemeta("foo-bar")) returns invalid string
User-Agent: Thunderbird 2.0.0.17 (X11/20080914)
Domainkey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:user-agent:mime-version:to:subject:references :in-reply-to:x-enigmail-version:content-type :content-transfer-encoding:from; b=sT+iyxKFVKYtm9lnGUEI5yN3MqXXmqlEVt/NleiYM5yTYM4q0XFSB8WHOw0W+febj9 tt7xQIFwAGwO9v1ACFJezcHoMpLVwZqhHC7KYEQC1k+NxS9xPZ5PKWwO4V8cOapxbdfX 9MHIzZSQN8KWNPDXvJ93NtpG1U9grXFcUxkkE=
Return-Path: <lpsolit [...] gmail.com>
Dkim-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:user-agent :mime-version:to:subject:references:in-reply-to:x-enigmail-version :content-type:content-transfer-encoding:from; bh=jEc/HTfDTpugvOCbXwVj1Y9zfmApUu8EjOznHcvICGA=; b=R1K/4zJOfdnc6iVaiSM0CIpOQbCXZreDzMwBeUwJ6E+GNd8DcDVGFkovl7WO9RHHDg 0+nBQa1ZPHDzAjyr2kuPvx71dpW09vnEcBk9kJ1z+Z+g4XGS7R6STnJaZ2c1svaXsdFt H5fmkwzvtczwF28Spe5iRAS99pVFmdDO6Ji+k=
X-Spam-Check-BY: 16.mx.develooper.com
X-Original-To: bug-DBD-Pg [...] rt.cpan.org
Date: Tue, 28 Oct 2008 19:12:24 +0100
X-Spam-Level: *
Message-Id: <49075608.4040403 [...] gmail.com>
To: bug-DBD-Pg [...] rt.cpan.org
X-Enigmail-Version: 0.95.7
Content-Transfer-Encoding: 8bit
From: Frédéric Buclin <lpsolit [...] gmail.com>
RT-Message-ID: <rt-3.6.HEAD-11115-1225217562-1890.40440-0-0 [...] rt.cpan.org>
Content-Length: 1230
Download (untitled) / with headers
text/plain 1.2k
Show quoted text
> Why are you using quotemeta here?
quotemeta() is currently in use in the Bugzilla code, which I'm contributing to. The context in which it's used is available here: http://mxr.mozilla.org/mozilla/source/webtools/bugzilla/Bugzilla/Search.pm#878 We use quotemeta() to escape characters before using the string in a regexp. I don't know if $dbh->quote() already escapes everything which is required to be used in regexp, which is why quotemeta() is called first. Show quoted text
> Please describe in detail what sort of crash occurs.
The problem is described here: https://bugzilla.mozilla.org/show_bug.cgi?id=461729 And the error is: DBD::Pg::st execute failed: ERREUR: erreur de syntaxe sur ou près de « foo » LINE 1: ...EOPENED') ) AND (bugs.keywords ~* '(^|[^a-z0-9])E'foo\\-bar(... The relevant part of the SQL query is: WHERE (( bugs.bug_status IN ('NEW','ASSIGNED','REOPENED') ) AND (bugs.keywords ~* '(^|[^a-z0-9])E'foo\\-bar($|[^a-z0-9])')) You should in general be using placeholders, and not Show quoted text
> trying to construct queries from the output of quote().
I know that, and our modern code does this. But in the case of Search.pm, that's pretty hard to do. I use PostgreSQL 8.3.4 and tried both DBD::Pg 2.10.3 and 2.11.2.
MIME-Version: 1.0 (Apple Message framework v929.2)
X-Spam-Status: No, hits=0.0 required=8.0 tests=
In-Reply-To: <rt-3.6.HEAD-11115-1225217562-1890.40440-5-0 [...] rt.cpan.org>
X-Mailer: Apple Mail (2.929.2)
References: <RT-Ticket-40440 [...] rt.cpan.org> <49065F6B.2030609 [...] gmail.com> <rt-3.6.HEAD-11125-1225155533-1916.40440-6-0 [...] rt.cpan.org> <49075608.4040403 [...] gmail.com> <rt-3.6.HEAD-11115-1225217562-1890.40440-5-0 [...] rt.cpan.org>
Content-Type: text/plain; charset="utf-8"; delsp="yes"; format="flowed"
X-RT-Original-Encoding: utf-8
Received: from la.mx.develooper.com (x1.develooper.com [63.251.223.170]) by diesel.bestpractical.com (Postfix) with SMTP id B29E719B80A3 for <bug-DBD-Pg [...] rt.cpan.org>; Tue, 28 Oct 2008 14:20:36 -0400 (EDT)
Received: (qmail 22093 invoked by uid 103); 28 Oct 2008 18:20:36 -0000
Received: from x16.dev (10.0.100.26) by x1.dev with QMQP; 28 Oct 2008 18:20:36 -0000
Received: from host-201.commandprompt.net (HELO smtp.kineticode.com) (207.173.203.201) by 16.mx.develooper.com (qpsmtpd/0.43rc1) with ESMTP; Tue, 28 Oct 2008 11:20:34 -0700
Received: from [192.168.1.104] (c-67-160-131-113.hsd1.or.comcast.net [67.160.131.113]) by smtp.kineticode.com (Postfix) with ESMTPSA id 28A0350805B for <bug-DBD-Pg [...] rt.cpan.org>; Tue, 28 Oct 2008 11:07:49 -0700 (PDT)
Delivered-To: cpan-bug+DBD-Pg [...] diesel.bestpractical.com
Subject: Re: [rt.cpan.org #40440] DBI->quote(quotemeta("foo-bar")) returns invalid string
Return-Path: <dwheeler [...] cpan.org>
X-Spam-Check-BY: 16.mx.develooper.com
X-Original-To: bug-DBD-Pg [...] rt.cpan.org
Date: Tue, 28 Oct 2008 11:20:30 -0700
X-Spam-Level: *
Message-Id: <B9017C17-56DB-4E54-A1BD-2BE0BBC0FAA7 [...] cpan.org>
To: bug-DBD-Pg [...] rt.cpan.org
Content-Transfer-Encoding: quoted-printable
From: "David E. Wheeler" <dwheeler [...] cpan.org>
RT-Message-ID: <rt-3.6.HEAD-11115-1225218047-216.40440-0-0 [...] rt.cpan.org>
Content-Length: 558
Download (untitled) / with headers
text/plain 558b
On Oct 28, 2008, at 11:12, Frédéric Buclin via RT wrote: Show quoted text
> The problem is described here: > > https://bugzilla.mozilla.org/show_bug.cgi?id=461729 > > And the error is: > > DBD::Pg::st execute failed: ERREUR: erreur de syntaxe sur ou près > de « > foo » > LINE 1: ...EOPENED') ) AND (bugs.keywords ~* '(^|[^a-z0-9])E'foo\\- > bar(... > > The relevant part of the SQL query is: > > WHERE (( bugs.bug_status IN ('NEW','ASSIGNED','REOPENED') ) AND > (bugs.keywords ~* '(^|[^a-z0-9])E'foo\\-bar($|[^a-z0-9])'))
Which part of that is $word? Bet, David
MIME-Version: 1.0
X-Spam-Status: No, hits=0.0 required=8.0 tests=DK_SIGNED,SPF_PASS
In-Reply-To: <rt-3.6.HEAD-11115-1225218047-216.40440-6-0 [...] rt.cpan.org>
References: <RT-Ticket-40440 [...] rt.cpan.org> <49065F6B.2030609 [...] gmail.com> <rt-3.6.HEAD-11125-1225155533-1916.40440-6-0 [...] rt.cpan.org> <49075608.4040403 [...] gmail.com> <rt-3.6.HEAD-11115-1225217562-1890.40440-5-0 [...] rt.cpan.org> <B9017C17-56DB-4E54-A1BD-2BE0BBC0FAA7 [...] cpan.org> <rt-3.6.HEAD-11115-1225218047-216.40440-6-0 [...] rt.cpan.org>
Content-Type: text/plain; charset=UTF-8
X-RT-Original-Encoding: utf-8
Received: from la.mx.develooper.com (x1.develooper.com [63.251.223.170]) by diesel.bestpractical.com (Postfix) with SMTP id 9F81F4D8068 for <bug-DBD-Pg [...] rt.cpan.org>; Tue, 28 Oct 2008 14:33:28 -0400 (EDT)
Received: (qmail 26253 invoked by uid 103); 28 Oct 2008 18:33:28 -0000
Received: from x16.dev (10.0.100.26) by x1.dev with QMQP; 28 Oct 2008 18:33:28 -0000
Received: from mail-gx0-f11.google.com (HELO mail-gx0-f11.google.com) (209.85.217.11) by 16.mx.develooper.com (qpsmtpd/0.43rc1) with ESMTP; Tue, 28 Oct 2008 11:33:25 -0700
Received: by gxk4 with SMTP id 4so13439gxk.21 for <bug-DBD-Pg [...] rt.cpan.org>; Tue, 28 Oct 2008 11:33:22 -0700 (PDT)
Received: by 10.103.198.15 with SMTP id a15mr3589925muq.9.1225218801239; Tue, 28 Oct 2008 11:33:21 -0700 (PDT)
Received: from ?192.168.1.33? (223-220.76-83.cust.bluewin.ch [83.76.220.223]) by mx.google.com with ESMTPS id j2sm7193996mue.4.2008.10.28.11.33.18 (version=TLSv1/SSLv3 cipher=RC4-MD5); Tue, 28 Oct 2008 11:33:19 -0700 (PDT)
Delivered-To: cpan-bug+DBD-Pg [...] diesel.bestpractical.com
Subject: Re: [rt.cpan.org #40440] DBI->quote(quotemeta("foo-bar")) returns invalid string
User-Agent: Thunderbird 2.0.0.17 (X11/20080914)
Domainkey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:user-agent:mime-version:to:subject:references :in-reply-to:x-enigmail-version:content-type :content-transfer-encoding:from; b=MQg/nUqTxTvw9ZM/cf774a/i15+41Tylsb2H0C3IhMVK4Y082FUzzbBavXrYNWve1H t4BenaQBl7lrB5zmhLNwMw8xEO42T7Aa4IZhkfdazaeAAKebTfHpZT5EDEBLkX+/fkHX 73cxiyI6xKVLGQnDXxw0aJEoC4ICbDaodCUm4=
Return-Path: <lpsolit [...] gmail.com>
Dkim-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:user-agent :mime-version:to:subject:references:in-reply-to:x-enigmail-version :content-type:content-transfer-encoding:from; bh=jsC1s2yjX2zyfSKZGiWns2ErDenM8swwg5sM9U/bLTE=; b=TmpMGXYtdA6+Kev4Njv0tUtDyu4y5PG94HQ/sAeqtEUPXQVbKVGUJKvPVrOTcSFwdL wYgBD5VPi4WHWHDw9zqWiDa6ah3IozRWf2Mf27TI513FMkTKruT6YRYu6u0+T8oxnZXE zYt7MDZ+1HSyY6Au0jwMvvCaoK7T9Wr9OqEKA=
X-Spam-Check-BY: 16.mx.develooper.com
X-Original-To: bug-DBD-Pg [...] rt.cpan.org
Date: Tue, 28 Oct 2008 19:33:16 +0100
X-Spam-Level: *
Message-Id: <49075AEC.2050303 [...] gmail.com>
To: bug-DBD-Pg [...] rt.cpan.org
X-Enigmail-Version: 0.95.7
Content-Transfer-Encoding: 7bit
From: Frédéric Buclin <lpsolit [...] gmail.com>
RT-Message-ID: <rt-3.6.HEAD-11115-1225218812-941.40440-0-0 [...] rt.cpan.org>
Content-Length: 205
Download (untitled) / with headers
text/plain 205b
Show quoted text
>> WHERE (( bugs.bug_status IN ('NEW','ASSIGNED','REOPENED') ) AND >> (bugs.keywords ~* '(^|[^a-z0-9])E'foo\\-bar($|[^a-z0-9])'))
> > Which part of that is $word?
E'foo\\-bar. It was originally foo-bar.
MIME-Version: 1.0
In-Reply-To: <rt-3.6.HEAD-11115-1225217562-1890.40440-0-0 [...] rt.cpan.org>
X-Mailer: MIME-tools 5.426 (Entity 5.426)
Content-Disposition: inline
Charset: utf8
References: <RT-Ticket-40440 [...] rt.cpan.org> <49065F6B.2030609 [...] gmail.com> <rt-3.6.HEAD-11125-1225155533-1916.40440-6-0 [...] rt.cpan.org> <49075608.4040403 [...] gmail.com> <rt-3.6.HEAD-11115-1225217562-1890.40440-0-0 [...] rt.cpan.org>
Message-Id: <rt-3.6.HEAD-11127-1225220187-1698.40440-0-0 [...] rt.cpan.org>
Content-Type: text/plain
Content-Transfer-Encoding: binary
X-RT-Original-Encoding: utf-8
Content-Length: 1036
Show quoted text
> LINE 1: ...EOPENED') ) AND (bugs.keywords ~* '(^|[^a-z0-9])E'foo\\- > bar(...
There's the problem. You can't just plug the output of $dbh->quote back into a random string. The only guarantee is that passing the output back to the *database* will produce the original string. If you look at the DBI docs for DBI, you'll see this example: === It is valid for the quote() method to return an SQL expression that evaluates to the desired string. For example: $quoted = $dbh->quote("one\ntwo\0three") may return something like: CONCAT('one', CHAR(12), 'two', CHAR(0), 'three') === What you need to do is to quote the final compiled string, and pass that directly in. That's far inferior to using a placeholder in the first place, but it should suffice. Other than that, there is no way around it - E'' is now the official Postgres way. Best: .. 'AND bugs.keywords ~* ?' If you must: $string = $dbh->quote( q{(^|[^a-z0-9])} . quotemeta('foo-bar') . q{($|[^a-z0-9])} ); $SQL .= "AND bugs.keywords ~* $safestring";
MIME-Version: 1.0
X-Spam-Status: No, hits=0.0 required=8.0 tests=DK_SIGNED,SPF_PASS
In-Reply-To: <rt-3.6.HEAD-11127-1225220187-1698.40440-6-0 [...] rt.cpan.org>
References: <RT-Ticket-40440 [...] rt.cpan.org> <49065F6B.2030609 [...] gmail.com> <rt-3.6.HEAD-11125-1225155533-1916.40440-6-0 [...] rt.cpan.org> <49075608.4040403 [...] gmail.com> <rt-3.6.HEAD-11115-1225217562-1890.40440-6-0 [...] rt.cpan.org> <rt-3.6.HEAD-11127-1225220187-1698.40440-6-0 [...] rt.cpan.org>
Content-Type: text/plain; charset=UTF-8
X-RT-Original-Encoding: utf-8
Received: from la.mx.develooper.com (x1.develooper.com [63.251.223.170]) by diesel.bestpractical.com (Postfix) with SMTP id 06C8A4D8005 for <bug-DBD-Pg [...] rt.cpan.org>; Wed, 29 Oct 2008 05:40:57 -0400 (EDT)
Received: (qmail 10005 invoked by uid 103); 29 Oct 2008 09:40:57 -0000
Received: from x16.dev (10.0.100.26) by x1.dev with QMQP; 29 Oct 2008 09:40:57 -0000
Received: from fg-out-1718.google.com (HELO fg-out-1718.google.com) (72.14.220.157) by 16.mx.develooper.com (qpsmtpd/0.43rc1) with ESMTP; Wed, 29 Oct 2008 02:40:54 -0700
Received: by fg-out-1718.google.com with SMTP id d23so3559060fga.15 for <bug-DBD-Pg [...] rt.cpan.org>; Wed, 29 Oct 2008 02:40:50 -0700 (PDT)
Received: by 10.86.66.19 with SMTP id o19mr5444271fga.18.1225273250844; Wed, 29 Oct 2008 02:40:50 -0700 (PDT)
Received: from ?192.168.1.33? (121-199.77-83.cust.bluewin.ch [83.77.199.121]) by mx.google.com with ESMTPS id 4sm3999487fge.8.2008.10.29.02.40.48 (version=TLSv1/SSLv3 cipher=RC4-MD5); Wed, 29 Oct 2008 02:40:49 -0700 (PDT)
Delivered-To: cpan-bug+DBD-Pg [...] diesel.bestpractical.com
Subject: Re: [rt.cpan.org #40440] DBI->quote(quotemeta("foo-bar")) returns invalid string
User-Agent: Thunderbird 2.0.0.17 (X11/20080914)
Domainkey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:user-agent:mime-version:to:subject:references :in-reply-to:x-enigmail-version:content-type :content-transfer-encoding:from; b=qa0lj+/MICQtCoStHjMZSeLgT/whpy0WgI8mQmE4csfsLzhV/sItiBBA5bQ7EOeY1I 5hIped7fgIpzAeo7N0CBkeNRyFgn54ZynPtryYGNZuWMnOll4w8szHG+KhYoOIzQR9Nb nlOTxQ4XmqEzUpXzpXPY/UlV/BP42zxD8aBRY=
Return-Path: <lpsolit [...] gmail.com>
Dkim-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:user-agent :mime-version:to:subject:references:in-reply-to:x-enigmail-version :content-type:content-transfer-encoding:from; bh=y6wnha9AL0cNXBHPaaB95vdEO3d0RnRRNANVA847wug=; b=c5T0AiKa/BJWZowHrkLbrfYwI5eajw6X0yYOuvrAQfK5AhwPiu+zXdvrj2YNfqeHFr c32t5B9w84/3v2tofqG7B0ULkTjhYFyKfYRXanPnvwTiAMs0fm378/wYe+JtNyYmoSW2 raAWDGL0riYqwiE3Fb5+uS79kYH77wwIGvucw=
X-Spam-Check-BY: 16.mx.develooper.com
X-Original-To: bug-DBD-Pg [...] rt.cpan.org
Date: Wed, 29 Oct 2008 10:40:47 +0100
X-Spam-Level: *
Message-Id: <49082F9F.6000406 [...] gmail.com>
To: bug-DBD-Pg [...] rt.cpan.org
X-Enigmail-Version: 0.95.7
Content-Transfer-Encoding: 8bit
From: Frédéric Buclin <lpsolit [...] gmail.com>
RT-Message-ID: <rt-3.6.HEAD-11100-1225273265-344.40440-0-0 [...] rt.cpan.org>
Content-Length: 290
Download (untitled) / with headers
text/plain 290b
Show quoted text
> What you need to do is to quote the final compiled string, and pass that > directly in.
Thanks a lot, greg. I did that and this indeed fixes our problem. Probably the original code was written with MySQL only in mind. You can close this bug report as invalid. Thanks again! Frédéric


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.