Here is a mailbox file that contains DBD:pg patches I have collected
over the years. I am sure many have not made it into the official
distribution.
Let me know if you have trouble reading it.
On a related note, someone questioned why I am the DBD:pg "maintainer"
if I don't know Perl. In fact, I am only the coordinator of the
project. I will do little coding and mostly just assist others in
coding, reviewing patches, and making releases. I don't want to have
_a_ maintainer of DBD:pg. This is an open source project so I don't
want all the work to have to filter through a single person. I think
this has caused the DBD:pg module to languish in the past.
--
Bruce Momjian | http://candle.pha.pa.us
[EMAIL PROTECTED] | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073
>From pgman Mon Jun 11 18:16:47 2001
Return-path: <pgman>
Received: (from pgman@localhost)
by candle.pha.pa.us (8.10.1/8.10.1) id f5BMGkB19047
for pgman; Mon, 11 Jun 2001 18:16:46 -0400 (EDT)
Received: from mail.postgresql.org (webmail.postgresql.org [216.126.85.28])
by candle.pha.pa.us (8.9.0/8.9.0) with ESMTP id BAA00195
for <[EMAIL PROTECTED]>; Sat, 24 Feb 2001 01:25:00 -0500 (EST)
Received: from mail.postgresql.org (webmail.postgresql.org [216.126.85.28])
by mail.postgresql.org (8.11.1/8.11.1) with SMTP id f1O6N5x72567;
Sat, 24 Feb 2001 01:23:05 -0500 (EST)
(envelope-from [EMAIL PROTECTED])
Received: from mail.postgresql.org (webmail.postgresql.org [216.126.85.28])
by mail.postgresql.org (8.11.1/8.11.1) with SMTP id f1O4Wkx51637
for <[EMAIL PROTECTED]>; Fri, 23 Feb 2001 23:32:46 -0500 (EST)
(envelope-from [EMAIL PROTECTED])
Received: from pippin.salon.com (pippin.salon.com [208.48.211.66])
by mail.postgresql.org (8.11.1/8.11.1) with ESMTP id f1NMgHx17867
for <[EMAIL PROTECTED]>; Fri, 23 Feb 2001 17:42:17 -0500 (EST)
(envelope-from [EMAIL PROTECTED])
Received: from localhost (garth@localhost)
by pippin.salon.com (8.9.3/8.9.3) with ESMTP id OAA31820
for <[EMAIL PROTECTED]>; Fri, 23 Feb 2001 14:42:06 -0800
X-Authentication-Warning: pippin.salon.com: garth owned process doing -bs
Date: Fri, 23 Feb 2001 14:42:06 -0800 (PST)
From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Subject: Re: [GENERAL] Handling of large objects in DBD::Pg? (fwd)
In-Reply-To: <[EMAIL PROTECTED]>
Message-ID: <[EMAIL PROTECTED]>
MIME-Version: 1.0
Content-Type: MULTIPART/MIXED; BOUNDARY="8323328-1172321252-982968126=:30639"
Precedence: bulk
Sender: pgman
Status: OR
This message is in MIME format. The first part should be readable text,
while the remaining parts are likely unreadable without MIME-aware tools.
Send mail to [EMAIL PROTECTED] for more info.
--8323328-1172321252-982968126=:30639
Content-Type: TEXT/PLAIN; charset=US-ASCII
Attached are large object read and write functions I wrote based on
information I gleened from the DBD::Pg install test script.
They read and write to buffers rather than files because my
information wasn't comming from a file and wasn't going to one. However
if you need the data to go to a file you can either open a file handle
yourself in these methods and read into a scalar or write out from one, OR
you can scan the test.pl file in the DBD::Pg install to see how to use the
proper file based read and write Pg calls.
M. Tavasti <[EMAIL PROTECTED]> wrote:
>
> How do I handle large objects in DBD:Pg (perl DBI interface to
> postgresql)?
>
> I've tried to do like this, but not successfull, it looks like there
> is no data inserted. I tried to see in psql is there something, doing
> SELECT lo_export(data,"/tmp/foofaa.txt") from foofaa where id=XXXX;
>
> $obj_ins = $dbh->prepare(q{
> INSERT INTO foofaa
> (id,entry,data)
> VALUES
> (?,?,?)});
>
> $obj = $dbh->func("./$dir/obj.txt", 'lo_import');
> $obj_ins->execute($id,$ent,$obj);
>
>
>
>
> Manual page of DBD:Pg if confusing for lo_export:
>
> $ret = $dbh->func($lobjId, 'lo_export');
>
> Exports a large object into a Unix file. Returns
> false upon failure, true otherwise.
>
> To what file....
>
> Any help welcome.
>
>
--8323328-1172321252-982968126=:30639
Content-Type: TEXT/PLAIN; charset=US-ASCII; name="lotest.pl"
Content-Transfer-Encoding: BASE64
Content-ID: <[EMAIL PROTECTED]>
Content-Description: Large Object access functions
Content-Disposition: attachment; filename="lotest.pl"
IyEvdXNyL2Jpbi9wZXJsIC13DQoNCnVzZSBzdHJpY3Q7DQoNCnVzZSBEQkk7
DQp1c2UgREJEOjpQZzsNCg0KbXkgJGRzbiA9ICJkYm5hbWU9cDEiOw0KbXkg
JGRiaCA9IERCSS0+Y29ubmVjdCgnZGJpOlBnOmRibmFtZT1wMScsIHVuZGVm
LCB1bmRlZiwgeyBBdXRvQ29tbWl0ID0+IDEgfSk7DQoNCm15ICRidWYgPSAn
YWJjZGVmZ2hpamtsbW5vcHFyc3R1dnd4eXonIHggNDAwOw0KDQpteSAkaWQg
PSB3cml0ZV9ibG9iKCRkYmgsIHVuZGVmLCAkYnVmKTsNCg0KbXkgJGRhdCA9
IHJlYWRfYmxvYigkZGJoLCAkaWQpOw0KDQpwcmludCAiRG9uZVxuIjsNCg0K
c3ViIHdyaXRlX2Jsb2Igew0KICAgIG15ICgkZGJoLCAkbG9ial9pZCwgJGRh
dGEpID0gQF87DQogICAgDQogICAgIyBiZWdpbiB0cmFuc2FjdGlvbg0KICAg
ICRkYmgtPntBdXRvQ29tbWl0fSA9IDA7DQogICAgDQogICAgIyBDcmVhdGUg
YSBuZXcgbG8gaWYgd2UgYXJlIG5vdCBwYXNzZWQgYW4gbG8gb2JqZWN0IElE
Lg0KICAgIHVubGVzcyAoJGxvYmpfaWQpIHsNCgkjIENyZWF0ZSB0aGUgb2Jq
ZWN0Lg0KCSRsb2JqX2lkID0gJGRiaC0+ZnVuYygkZGJoLT57J3BnX0lOVl9X
UklURSd9LCAnbG9fY3JlYXQnKTsNCiAgICB9ICAgIA0KDQogICAgIyBPcGVu
IGl0IHRvIGdldCBhIGZpbGUgZGVzY3JpcHRvci4NCiAgICBteSAkbG9ial9m
ZCA9ICRkYmgtPmZ1bmMoJGxvYmpfaWQsICRkYmgtPnsncGdfSU5WX1dSSVRF
J30sICdsb19vcGVuJyk7DQoNCiAgICAkZGJoLT5mdW5jKCRsb2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w0KICAgIH0NCg0KICAgICRkYmgt
PmZ1bmMoJGxvYmpfZmQsICdsb19jbG9zZScpIG9yIGRpZSAiUHJvYmxlbXMg
Y2xvc2luZyBsbyBvYmplY3RcbiI7DQoNCiAgICAjIGVuZCB0cmFuc2FjdGlv
bg0KICAgICRkYmgtPntBdXRvQ29tbWl0fSA9IDE7DQogICAgICAgDQogICAg
cmV0dXJuICRkYXRhOw0KfQ0K
--8323328-1172321252-982968126=:30639--
>From [EMAIL PROTECTED] Fri May 4 08:07:19 2001
Return-path: <[EMAIL PROTECTED]>
Received: from postgresql.org (webmail.postgresql.org [216.126.85.28])
by candle.pha.pa.us (8.10.1/8.10.1) with ESMTP id f44C7I411531
for <[EMAIL PROTECTED]>; Fri, 4 May 2001 08:07:18 -0400 (EDT)
Received: from postgresql.org.org (webmail.postgresql.org [216.126.85.28])
by postgresql.org (8.11.3/8.11.1) with SMTP id f44C6uA69602;
Fri, 4 May 2001 08:06:56 -0400 (EDT)
(envelope-from [EMAIL PROTECTED])
Received: from edison.ioppublishing.com (edison.ioppublishing.com [193.128.223.242])
by postgresql.org (8.11.3/8.11.1) with SMTP id f44BrIA65086
for <[EMAIL PROTECTED]>; Fri, 4 May 2001 07:53:18 -0400 (EDT)
(envelope-from [EMAIL PROTECTED])
Received: (qmail 24583 invoked from network); 4 May 2001 11:49:57 -0000
Received: from localhost (HELO edison.ioppublishing.com) ([EMAIL PROTECTED])
by localhost with SMTP; 4 May 2001 11:49:57 -0000
Content-Type: text/plain
Content-Disposition: inline
Content-Transfer-Encoding: 7bit
MIME-Version: 1.0
From: "Peter Haworth" <[EMAIL PROTECTED]>
To: Vivek Khera <[EMAIL PROTECTED]>, [EMAIL PROTECTED]
cc: [EMAIL PROTECTED]
Subject: Re: [GENERAL] DBD::Pg errstr method doesn't return full error
messages
Date: Fri, 4 May 2001 12:49:57 +0100
Message-ID: <[EMAIL PROTECTED]>
X-Mailer: PGM v0.14
References: <[EMAIL PROTECTED]>
Precedence: bulk
Sender: [EMAIL PROTECTED]
Status: ORr
On Thu, 3 May 2001 15:24:31 -0400, Vivek Khera wrote:
> Hi, I'm using DBD::Pg version 0.98 with Postgres 7.1. I'm noticing
> that quite often on an error, the $dbh->errstr method doesn't return
> the full error.
Here's a patch to DBD::Pg 0.98 which fixes this:
--- dbdimp.c.orig Tue May 1 11:46:47 2001
+++ dbdimp.c Tue May 1 11:55:26 2001
@@ -72,18 +72,21 @@
char *error_msg;
{
D_imp_xxh(h);
- char *err, *src, *dst;
+ char *err, *src, *dst, *end;
int len = strlen(error_msg);
- err = (char *)malloc(strlen(error_msg + 1));
+ err = (char *)malloc(len + 1);
if (!err) {
return;
}
+ /* Remove trailing newlines, allowing for multi-line messages */
+ for(end = error_msg + len; end > error_msg && end[-1] == '\n'; --end);
+
src = error_msg;
dst = err;
/* copy error message without trailing newlines */
- while (*dst != '\0' && *dst != '\n') {
+ while (src < end){
*dst++ = *src++;
}
*dst = '\0';
--
Peter Haworth [EMAIL PROTECTED]
"A good messenger expects to get shot."
--Larry Wall
---------------------------(end of broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to [EMAIL PROTECTED]
>From [EMAIL PROTECTED] Fri May 11 10:39:02 2001
Return-path: <[EMAIL PROTECTED]>
Received: from postgresql.org (webmail.postgresql.org [216.126.85.28])
by candle.pha.pa.us (8.10.1/8.10.1) with ESMTP id f4BEd1u17186
for <[EMAIL PROTECTED]>; Fri, 11 May 2001 10:39:01 -0400 (EDT)
Received: from postgresql.org.org (webmail.postgresql.org [216.126.85.28])
by postgresql.org (8.11.3/8.11.1) with SMTP id f4BEcsA02066;
Fri, 11 May 2001 10:38:54 -0400 (EDT)
(envelope-from [EMAIL PROTECTED])
Received: from postgresql.org.org (webmail.postgresql.org [216.126.85.28])
by postgresql.org (8.11.3/8.11.1) with SMTP id f4BDmuA77135
for <[EMAIL PROTECTED]>; Fri, 11 May 2001 09:48:56 -0400 (EDT)
(envelope-from [EMAIL PROTECTED])
Received: from bender.bawue.de (bender.bawue.de [193.197.13.1])
by postgresql.org (8.11.3/8.11.1) with ESMTP id f48JKkA19881
for <[EMAIL PROTECTED]>; Tue, 8 May 2001 15:20:47 -0400 (EDT)
(envelope-from [EMAIL PROTECTED])
Received: from bawue.de (sls.s.bawue.de [193.197.12.218])
by bender.bawue.de (Postfix) with ESMTP
id DFADA4864D; Tue, 8 May 2001 21:20:42 +0200 (CEST)
Message-ID: <[EMAIL PROTECTED]>
Date: Tue, 08 May 2001 21:20:35 +0200
From: Edmund Mergl <[EMAIL PROTECTED]>
X-Mailer: Mozilla 4.77 [en] (X11; U; Linux 2.2.17-14 i686)
X-Accept-Language: en
MIME-Version: 1.0
To: Bruce Momjian <[EMAIL PROTECTED]>
cc: Peter Haworth <[EMAIL PROTECTED]>,
Vivek Khera <[EMAIL PROTECTED]>, [EMAIL PROTECTED]
Subject: Re: [GENERAL] DBD::Pg errstr method doesn't return full error
messages
References: <[EMAIL PROTECTED]>
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Precedence: bulk
Sender: [EMAIL PROTECTED]
Status: ORr
Bruce Momjian wrote:
>
> Has this gotten back to the DBD Perl maintainers?
>
yes, I just want to to apply some more patches,
before releasing the next version.
Edmund
--
http://www.edmund-mergl.de
fon: +49 700 edemergl
---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
(send "unregister YourEmailAddressHere" to [EMAIL PROTECTED])
>From [EMAIL PROTECTED] Thu May 24 13:23:38 2001
Return-path: <[EMAIL PROTECTED]>
Received: from postgresql.org (webmail.postgresql.org [216.126.85.28])
by candle.pha.pa.us (8.10.1/8.10.1) with ESMTP id f4OHNbt18609
for <[EMAIL PROTECTED]>; Thu, 24 May 2001 13:23:38 -0400 (EDT)
Received: from postgresql.org.org (webmail.postgresql.org [216.126.85.28])
by postgresql.org (8.11.3/8.11.1) with SMTP id f4OHNEA42477;
Thu, 24 May 2001 13:23:14 -0400 (EDT)
(envelope-from [EMAIL PROTECTED])
Received: from ra.sai.msu.su (ra.sai.msu.su [158.250.29.2])
by postgresql.org (8.11.3/8.11.1) with ESMTP id f4OGsaA29620
for <[EMAIL PROTECTED]>; Thu, 24 May 2001 12:54:37 -0400 (EDT)
(envelope-from [EMAIL PROTECTED])
Received: from ra (ra [158.250.29.2])
by ra.sai.msu.su (8.9.3/8.9.3) with ESMTP id TAA27732;
Thu, 24 May 2001 19:54:11 +0300 (GMT)
Date: Thu, 24 May 2001 19:54:11 +0300 (GMT)
From: Oleg Bartunov <[EMAIL PROTECTED]>
X-X-Sender: <[EMAIL PROTECTED]>
To: Zachary Beane <[EMAIL PROTECTED]>
cc: <[EMAIL PROTECTED]>
Subject: Re: [INTERFACES] DBD::Pg or DBI breakage?
In-Reply-To: <[EMAIL PROTECTED]>
Message-ID: <[EMAIL PROTECTED]>
MIME-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII
Precedence: bulk
Sender: [EMAIL PROTECTED]
Status: OR
Zach,
We just found a bug in DBD-PG 0.98 and sent bug report to Edmund.
You may try our patch:
Regards,
Oleg
>From [EMAIL PROTECTED] Thu May 24 19:51:22 2001
Date: Thu, 24 May 2001 20:49:46 +0400 (MSD)
From: Ivan E. Panchenko <[EMAIL PROTECTED]>
To: Edmund Mergl <[EMAIL PROTECTED]>
Cc: Oleg Bartunov <[EMAIL PROTECTED]>
Subject: DBD-Pg-0.98 horrible segfault bug !!!
Dear Edmund,
There is a horrible bug in DBD-Pg introduced in the 0.98 version.
It can lead to a segmentation falut under some random circumstances,
namely, in the case of my applications.
This bug lives in pg_error() , dbdimp.c near line 90 and consists of two
ugly mistakes. Please see the patch below.
I would greatly appreciate the prompt inclusion of this patch in the next
version.
Regards, Ivan
--- DBD-Pg-0.98/dbdimp.c Wed Apr 25 15:29:06 2001
+++ DBD-Pg-0.98a/dbdimp.c Thu May 24 20:12:52 2001
@@ -75,15 +75,16 @@
char *err, *src, *dst;
int len = strlen(error_msg);
- err = (char *)malloc(strlen(error_msg + 1));
+ err = (char *)malloc(strlen(error_msg) + 1);
if (!err) {
return;
}
src = error_msg;
dst = err;
+
/* copy error message without trailing newlines */
- while (*dst != '\0' && *dst != '\n') {
+ while (*src != '\0' && *src != '\n') {
*dst++ = *src++;
}
*dst = '\0';
On Wed, 23 May 2001, Zachary Beane wrote:
> I've been having trouble getting the proper value of $handle->errstr
> or $DBI::errstr. For some reason, it's always giving the scalar 7 back
> rather than an informative error message. Here's an script and output:
>
> --- foo.pl ---
> #!/usr/bin/perl
>
> use DBI;
> my $dbh = DBI->connect("dbi:Pg:dbname=template1", "xach", undef);
>
> my $sql = "bogus sql goes here";
> my $sth = $dbh->prepare($sql);
> $sth->execute() or die $sth->errstr;
>
> my ($result) = $sth->fetchrow_array();
>
> $sth->finish;
>
> print $result, "\n";
> $dbh->disconnect();
> --- end ---
>
> When run, it prints out this:
>
> $ perl foo.pl
> DBD::Pg::st execute failed: at foo.pl line 8.
> 7 at foo.pl line 8.
> Database handle destroyed without explicit disconnect.
>
> Now, I'm not surprised at the "database handle destroyed..." part, but
> I can't figure out why i'm getting "7 at foo.pl" and a blank message
> in the execute failed string. Any ideas?
>
> Zach
>
_____________________________________________________________
Oleg Bartunov, sci.researcher, hostmaster of AstroNet,
Sternberg Astronomical Institute, Moscow University (Russia)
Internet: [EMAIL PROTECTED], http://www.sai.msu.su/~megera/
phone: +007(095)939-16-83, +007(095)939-23-83
---------------------------(end of broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to [EMAIL PROTECTED]
>From [EMAIL PROTECTED] Sun Jun 10 16:09:14 2001
Return-path: <[EMAIL PROTECTED]>
Received: from postgresql.org (webmail.postgresql.org [216.126.85.28])
by candle.pha.pa.us (8.10.1/8.10.1) with ESMTP id f5AK9DM23365
for <[EMAIL PROTECTED]>; Sun, 10 Jun 2001 16:09:13 -0400 (EDT)
Received: from postgresql.org.org (webmail.postgresql.org [216.126.85.28])
by postgresql.org (8.11.3/8.11.1) with SMTP id f5AK99E50956;
Sun, 10 Jun 2001 16:09:09 -0400 (EDT)
(envelope-from [EMAIL PROTECTED])
Received: from spider.pilosoft.com (p55-222.acedsl.com [160.79.55.222])
by postgresql.org (8.11.3/8.11.1) with ESMTP id f5AJogE45441
for <[EMAIL PROTECTED]>; Sun, 10 Jun 2001 15:50:42 -0400 (EDT)
(envelope-from [EMAIL PROTECTED])
Received: from localhost (alexmail@localhost)
by spider.pilosoft.com (8.9.3/8.9.3) with ESMTP id PAA04439;
Sun, 10 Jun 2001 15:59:45 -0400 (EDT)
Date: Sun, 10 Jun 2001 15:59:45 -0400 (EDT)
From: Alex Pilosov <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED]
cc: [EMAIL PROTECTED]
Subject: [INTERFACES] [PATCH] notify support for DBD::Pg
Message-ID: <[EMAIL PROTECTED]>
MIME-Version: 1.0
Content-Type: MULTIPART/MIXED; BOUNDARY="0-1555397714-992202872=:23782"
Content-ID: <[EMAIL PROTECTED]>
Precedence: bulk
Sender: [EMAIL PROTECTED]
Status: OR
This message is in MIME format. The first part should be readable text,
while the remaining parts are likely unreadable without MIME-aware tools.
Send mail to [EMAIL PROTECTED] for more info.
--0-1555397714-992202872=:23782
Content-Type: TEXT/PLAIN; CHARSET=US-ASCII
Content-ID: <[EMAIL PROTECTED]>
Edmund & all,
Attached is a patch to add support for asynchronous notifications to
DBD::Pg interface.
Added following functions (self-documented in Pg.pm):
$ret = $dbh->func('notifies');
Returns either undef or a reference to two-element array
[ $table, $backend_pid ] of asynchronous notifications received.
$fd = $dbh->func('getfd');
Returns fd of the actual connection to server. Can be used with
select() and func('notifies').
Also modified test.pl to test all of this functionality in the following
sequence (listen, select, notify, select).
Edmund, please consider adding to next release.
Thanks
-alex
--0-1555397714-992202872=:23782
Content-Type: TEXT/PLAIN; charset=US-ASCII; name="dbdpg.patch"
Content-Transfer-Encoding: BASE64
Content-ID: <[EMAIL PROTECTED]>
Content-Description: dbdpg_notifies.patch
Content-Disposition: attachment; filename="dbdpg.patch"
ZGlmZiAtciAtLXVuaWZp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5k
aXNjb25uZWN0ICkNCisgICAgYW5kIHByaW50ICJcJGRiaDEtPmRpc2Nvbm5l
Y3QgLi4uLi4uLi4uLiBva1xuIg0KKyAgICBvciAgZGllICAgIlwkZGJoMS0+
ZGlzY29ubmVjdCAuLi4uLi4uLi4uIG5vdCBvazogIiwgJERCSTo6ZXJyc3Ry
Ow0KIA0KICRkYmgwLT5kbygiRFJPUCBEQVRBQkFTRSAkZGJ0ZXN0Iik7DQog
JGRiaDAtPmRpc2Nvbm5lY3Q7DQo=
--0-1555397714-992202872=:23782
Content-Type: text/plain
Content-Disposition: inline
Content-Transfer-Encoding: binary
MIME-Version: 1.0
---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster
--0-1555397714-992202872=:23782--
>From [EMAIL PROTECTED] Tue Nov 6 13:08:58 2001
Return-path: <[EMAIL PROTECTED]>
Received: from mailout00.sul.t-online.de (mailout00.sul.t-online.com [194.25.134.16])
by candle.pha.pa.us (8.11.6/8.10.1) with ESMTP id fA6J8wi12442
for <[EMAIL PROTECTED]>; Tue, 6 Nov 2001 14:08:58 -0500 (EST)
Received: from fwd00.sul.t-online.de
by mailout00.sul.t-online.de with smtp
id 161Bb2-0003JE-09; Tue, 06 Nov 2001 20:09:16 +0100
Received: from sls-isdn.s.bawue.de (520078144162-0001@[217.230.26.108]) by
fmrl00.sul.t-online.com
with esmtp id 161Bar-200mUyC; Tue, 6 Nov 2001 20:09:05 +0100
Received: from bawue.de (sls.s.bawue.de [193.197.12.218])
by sls-isdn.s.bawue.de (8.11.6/8.11.6) with ESMTP id fA6J8jT10997;
Tue, 6 Nov 2001 20:08:45 +0100
Sender: [EMAIL PROTECTED]
Message-ID: <[EMAIL PROTECTED]>
Date: Tue, 06 Nov 2001 20:09:22 +0100
From: Edmund Mergl <[EMAIL PROTECTED]>
X-Mailer: Mozilla 4.77 [en] (X11; U; Linux 2.4.9-6 i686)
X-Accept-Language: en
MIME-Version: 1.0
To: Bruce Momjian <[EMAIL PROTECTED]>
Subject: Re: [GENERAL] DBD::Pg errstr method doesn't return full error
messages
References: <[EMAIL PROTECTED]>
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
X-Sender: [EMAIL PROTECTED]
Status: ORr
Bruce Momjian wrote:
>
> > Bruce Momjian wrote:
> > >
> > > Has this gotten back to the DBD Perl maintainers?
> > >
> >
> > yes, I just want to to apply some more patches,
> > before releasing the next version.
>
> Edmund, I haven't heard any comment from you on rolling the DBD driver
> into the PostgreSQL CVS tree. Do you like the idea?
>
> --
> Bruce Momjian | http://candle.pha.pa.us
> [EMAIL PROTECTED] | (610) 853-3000
> + If your life is a hard drive, | 830 Blythe Avenue
> + Christ can be your backup. | Drexel Hill, Pennsylvania 19026
not really, most of the patches I got in the past where incomplete,
some even wrong. Anyway, my time is limited, so this might be a good idea.
A long time ago, I had a telnet account on hub.org ? I don't remember.
Can you help me to add the sources to the cvs ?
Edmund
--
http://www.edmund-mergl.de
fon: +49 700 edemergl
>From [EMAIL PROTECTED] Sat Nov 17
>23:12:06 2001
Return-path: <[EMAIL PROTECTED]>
Received: from rs.postgresql.org (server1.pgsql.org [64.39.15.238] (may be forged))
by candle.pha.pa.us (8.11.6/8.10.1) with ESMTP id fAI5C6v11278
for <[EMAIL PROTECTED]>; Sun, 18 Nov 2001 00:12:06 -0500 (EST)
Received: from postgresql.org (postgresql.org [64.49.215.8])
by rs.postgresql.org (8.11.6/8.11.6) with ESMTP id fAI597N49891
for <[EMAIL PROTECTED]>; Sat, 17 Nov 2001 23:09:08 -0600 (CST)
(envelope-from
[EMAIL PROTECTED])
Received: from mercury.atomicode.com (dnai-216-15-61-5.cust.dnai.com [216.15.61.5])
by postgresql.org (8.11.3/8.11.4) with ESMTP id fAI4wem35080
for <[EMAIL PROTECTED]>; Sat, 17 Nov 2001 23:58:41 -0500 (EST)
(envelope-from [EMAIL PROTECTED])
Received: from mercury (IDENT:david@mercury [127.0.0.1])
by mercury.atomicode.com (8.11.6/8.11.6) with ESMTP id fAI4wlN01904
for <[EMAIL PROTECTED]>; Sat, 17 Nov 2001 20:58:47 -0800
Subject: [GENERAL] DBD::Pg BYTEA Character Escaping
From: David Wheeler <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED]
Content-Type: text/plain
Content-Transfer-Encoding: 7bit
X-Mailer: Evolution/0.99.0 (Preview Release)
Date: 17 Nov 2001 20:58:46 -0800
Message-ID: <[EMAIL PROTECTED]>
MIME-Version: 1.0
Precedence: bulk
Sender: [EMAIL PROTECTED]
Status: ORr
Hi All,
I recently noticed that the DBD::Pg Perl module appears to be doing a
lot of work escaping characters for BYTEA data types. It's importing
Perl's POSIX support to check every character in BYTEA data with
isprint(), and replacing it with its octal representation if its not
printable.
However, there are two issues with this approach. The first is
efficiency. The way the code is currently written in DBD::Pg does a
*lot* of unnecessary work, and I'd like to suggest an optimization
(based on discussions on this topic on the Fun with Perl mail list:
http://archive.develooper.com/fwp%40perl.org/msg00458.html -- patch
supplied upon request).
The second issue, however, is that it doesn't appear to me that it's
even necessary that non-printable characters be replaced. Although Alex
Pilosov says that such an approach is needed:
http://www.geocrawler.com/mail/msg.php3?msg_id=6509224&list=10
Joe Conway found that there were only three characters ('\', "'", and
"\0") that needed to be escaped, and it was those three characters that
Bruce Momjian documented for the forthcoming 7.2 release:
http://www.geocrawler.com/mail/msg.php3?msg_id=6547225&list=10
If that's true, then any solution escaping non-printable characters is
overkill, and therefore only the three characters need to be escaped.
And since it looks like two of them ('\' and "'") are already escaped
before the non-printable characters are escaped in DBD::Pg, it then it
seems that this code:
if ($data_type == DBI::SQL_BINARY ||
$data_type == DBI::SQL_VARBINARY ||
$data_type == DBI::SQL_LONGVARBINARY) {
$str=join("", map { isprint($_)?$_:'\\'.sprintf("%03o",ord($_)) }
split //, $str);
}
Could be changed to:
s/\0/\\000/g if $data_type == DBI::SQL_BINARY ||
$data_type == DBI::SQL_VARBINARY ||
$data_type == DBI::SQL_LONGVARBINARY;
So, the reason I'm posting this query is because I'd like to get
confirmation, if possible, on this conclusion. Based on the feedback I
receive, I will submit patches to the DBD::Pg maintainer.
Thanks!
David
PS: If discussion of this issue needs to be moved to the Hackers list,
I'll be happy to do so. I just thought I'd try here, first.
--
David Wheeler AIM: dwTheory
[EMAIL PROTECTED] ICQ: 15726394
Yahoo!: dew7e
Jabber: [EMAIL PROTECTED]
---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?
http://www.postgresql.org/users-lounge/docs/faq.html
>From [EMAIL PROTECTED] Sun Nov 18
>00:07:15 2001
Return-path: <[EMAIL PROTECTED]>
Received: from rs.postgresql.org (server1.pgsql.org [64.39.15.238] (may be forged))
by candle.pha.pa.us (8.11.6/8.10.1) with ESMTP id fAI67Ev13717
for <[EMAIL PROTECTED]>; Sun, 18 Nov 2001 01:07:14 -0500 (EST)
Received: from postgresql.org (postgresql.org [64.49.215.8])
by rs.postgresql.org (8.11.6/8.11.6) with ESMTP id fAI644N51316
for <[EMAIL PROTECTED]>; Sun, 18 Nov 2001 00:04:04 -0600 (CST)
(envelope-from
[EMAIL PROTECTED])
Received: from sss.pgh.pa.us ([192.204.191.242])
by postgresql.org (8.11.3/8.11.4) with ESMTP id fAI5khm36000
for <[EMAIL PROTECTED]>; Sun, 18 Nov 2001 00:46:43 -0500 (EST)
(envelope-from [EMAIL PROTECTED])
Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1])
by sss.pgh.pa.us (8.11.4/8.11.4) with ESMTP id fAI5klc02122;
Sun, 18 Nov 2001 00:46:47 -0500 (EST)
To: David Wheeler <[EMAIL PROTECTED]>
cc: [EMAIL PROTECTED]
Subject: Re: [GENERAL] DBD::Pg BYTEA Character Escaping
In-Reply-To: <[EMAIL PROTECTED]>
References: <[EMAIL PROTECTED]>
Comments: In-reply-to David Wheeler <[EMAIL PROTECTED]>
message dated "17 Nov 2001 20:58:46 -0800"
Date: Sun, 18 Nov 2001 00:46:46 -0500
Message-ID: <[EMAIL PROTECTED]>
From: Tom Lane <[EMAIL PROTECTED]>
Precedence: bulk
Sender: [EMAIL PROTECTED]
Status: OR
David Wheeler <[EMAIL PROTECTED]> writes:
> If that's true, then any solution escaping non-printable characters is
> overkill, and therefore only the three characters need to be escaped.
Check ...
> Could be changed to:
> s/\0/\\000/g if $data_type == DBI::SQL_BINARY ||
> $data_type == DBI::SQL_VARBINARY ||
> $data_type == DBI::SQL_LONGVARBINARY;
Offhand I don't think you even need the check on the datatype; wouldn't
it be faster and safer to do the substitution unconditionally? I can't
see that there are any cases that work without this substitution and
fail with it.
regards, tom lane
---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
(send "unregister YourEmailAddressHere" to [EMAIL PROTECTED])
>From [EMAIL PROTECTED] Sun Nov 18
>11:13:37 2001
Return-path: <[EMAIL PROTECTED]>
Received: from rs.postgresql.org (server1.pgsql.org [64.39.15.238] (may be forged))
by candle.pha.pa.us (8.11.6/8.10.1) with ESMTP id fAIHDav22646
for <[EMAIL PROTECTED]>; Sun, 18 Nov 2001 12:13:36 -0500 (EST)
Received: from postgresql.org (postgresql.org [64.49.215.8])
by rs.postgresql.org (8.11.6/8.11.6) with ESMTP id fAIH9oN69550
for <[EMAIL PROTECTED]>; Sun, 18 Nov 2001 11:09:50 -0600 (CST)
(envelope-from
[EMAIL PROTECTED])
Received: from spider.pilosoft.com (p55-222.acedsl.com [160.79.55.222])
by postgresql.org (8.11.3/8.11.4) with ESMTP id fAIGaYm90091
for <[EMAIL PROTECTED]>; Sun, 18 Nov 2001 11:36:38 -0500 (EST)
(envelope-from [EMAIL PROTECTED])
Received: from localhost (alexmail@localhost)
by spider.pilosoft.com (8.9.3/8.9.3) with ESMTP id LAA31395;
Sun, 18 Nov 2001 11:40:58 -0500 (EST)
Date: Sun, 18 Nov 2001 11:40:57 -0500 (EST)
From: Alex Pilosov <[EMAIL PROTECTED]>
To: David Wheeler <[EMAIL PROTECTED]>
cc: [EMAIL PROTECTED]
Subject: Re: [GENERAL] DBD::Pg BYTEA Character Escaping
In-Reply-To: <[EMAIL PROTECTED]>
Message-ID: <[EMAIL PROTECTED]>
MIME-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII
Precedence: bulk
Sender: [EMAIL PROTECTED]
Status: OR
On 17 Nov 2001, David Wheeler wrote:
> The second issue, however, is that it doesn't appear to me that it's
> even necessary that non-printable characters be replaced. Although Alex
> Pilosov says that such an approach is needed:
>
> http://www.geocrawler.com/mail/msg.php3?msg_id=6509224&list=10
I didn't say it was needed :) I just had the easy way out and escaped
everything that might possibly need to be escaped.
> Joe Conway found that there were only three characters ('\', "'", and
> "\0") that needed to be escaped, and it was those three characters that
> Bruce Momjian documented for the forthcoming 7.2 release:
Right.
> http://www.geocrawler.com/mail/msg.php3?msg_id=6547225&list=10
>
> If that's true, then any solution escaping non-printable characters is
> overkill, and therefore only the three characters need to be escaped.
> And since it looks like two of them ('\' and "'") are already escaped
> before the non-printable characters are escaped in DBD::Pg, it then it
> seems that this code:
>
> if ($data_type == DBI::SQL_BINARY ||
> $data_type == DBI::SQL_VARBINARY ||
> $data_type == DBI::SQL_LONGVARBINARY) {
> $str=join("", map { isprint($_)?$_:'\\'.sprintf("%03o",ord($_)) }
> split //, $str);
> }
>
> Could be changed to:
>
> s/\0/\\000/g if $data_type == DBI::SQL_BINARY ||
> $data_type == DBI::SQL_VARBINARY ||
> $data_type == DBI::SQL_LONGVARBINARY;
Yep.
>
> So, the reason I'm posting this query is because I'd like to get
> confirmation, if possible, on this conclusion. Based on the feedback I
> receive, I will submit patches to the DBD::Pg maintainer.
Go right ahead.
-alex
---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to [EMAIL PROTECTED] so that your
message can get through to the mailing list cleanly
>From [EMAIL PROTECTED] Sun Nov 18
>15:37:56 2001
Return-path: <[EMAIL PROTECTED]>
Received: from rs.postgresql.org (server1.pgsql.org [64.39.15.238] (may be forged))
by candle.pha.pa.us (8.11.6/8.10.1) with ESMTP id fAILbtv08607
for <[EMAIL PROTECTED]>; Sun, 18 Nov 2001 16:37:56 -0500 (EST)
Received: from postgresql.org (postgresql.org [64.49.215.8])
by rs.postgresql.org (8.11.6/8.11.6) with ESMTP id fAILZAN76950
for <[EMAIL PROTECTED]>; Sun, 18 Nov 2001 15:35:10 -0600 (CST)
(envelope-from
[EMAIL PROTECTED])
Received: from mercury.atomicode.com (dnai-216-15-61-5.cust.dnai.com [216.15.61.5])
by postgresql.org (8.11.3/8.11.4) with ESMTP id fAILLZm99168
for <[EMAIL PROTECTED]>; Sun, 18 Nov 2001 16:21:35 -0500 (EST)
(envelope-from [EMAIL PROTECTED])
Received: from mercury (IDENT:david@mercury [127.0.0.1])
by mercury.atomicode.com (8.11.6/8.11.6) with ESMTP id fAILLU901077;
Sun, 18 Nov 2001 13:21:31 -0800
Subject: Re: [GENERAL] DBD::Pg BYTEA Character Escaping
From: David Wheeler <[EMAIL PROTECTED]>
To: Tom Lane <[EMAIL PROTECTED]>
cc: [EMAIL PROTECTED]
In-Reply-To: <[EMAIL PROTECTED]>
References: <[EMAIL PROTECTED]>
<[EMAIL PROTECTED]>
Content-Type: multipart/mixed; boundary="=-GN/UeNODcasng/+vVZrj"
X-Mailer: Evolution/0.99.0 (Preview Release)
Date: 18 Nov 2001 13:21:30 -0800
Message-ID: <[EMAIL PROTECTED]>
MIME-Version: 1.0
Precedence: bulk
Sender: [EMAIL PROTECTED]
Status: OR
--=-GN/UeNODcasng/+vVZrj
Content-Type: text/plain
Content-Transfer-Encoding: 7bit
On Sat, 2001-11-17 at 21:46, Tom Lane wrote:
> Offhand I don't think you even need the check on the datatype; wouldn't
> it be faster and safer to do the substitution unconditionally? I can't
> see that there are any cases that work without this substitution and
> fail with it.
In that case, I suggest the attached, even more simplified patch. It
assumes that the quote character stored in $lp in the existing version
is always "'" (a safe assumption for DBD:Pg, I think, in a way it wasn't
for DBI, from whence the code for the LITERAL_PREFIX and LITERAL_SUFFIX
was copied into DBD::Pg), and therefore performs the escaping of the
three agreed-upon characters for all non-numeric data types.
If you agree that this tack makes sense, I'll submit the patch to Edmund
Mergl.
Regards,
Daviid
--
David Wheeler AIM: dwTheory
[EMAIL PROTECTED] ICQ: 15726394
Yahoo!: dew7e
Jabber: [EMAIL PROTECTED]
--=-GN/UeNODcasng/+vVZrj
Content-Disposition: attachment; filename=DBD-Pg.diff
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain; charset=ISO-8859-1
--- /usr/local/lib/perl5/site_perl/5.6.1/ppc-linux/DBD/Pg.pm Wed Jun 27 10:=
54:58 2001
+++ bin/Pg.pm Sun Nov 18 13:20:36 2001
@@ -104,7 +104,12 @@
=20
{ package DBD::Pg::db; # =3D=3D=3D=3D=3D=3D DATABASE =3D=3D=3D=3D=3D=3D
use strict;
- use POSIX(qw(isprint)); # necessary for quote()
+
+ # Characters that need to be escaped by quote().
+ my %esc =3D ( "'" =3D> '\\047', # '\\' . sprintf("%03o", ord("'")), #=
ISO SQL 2
+ '\\' =3D> '\\134', # '\\' . sprintf("%03o", ord("\\")),
+ "\0" =3D> '\\000' # '\\' . sprintf("%03o", ord("\0")),
+ );
=20
sub prepare {
my($dbh, $statement, @attribs)=3D @_;
@@ -341,48 +346,23 @@
=20
sub quote {
my ($dbh, $str, $data_type) =3D @_;
-
return "NULL" unless defined $str;
=20
- unless ($data_type) {
- $str =3D~ s/'/''/g; # ISO SQL2
- # In addition to the DBI method it doubles also the
- # backslash, because PostgreSQL treats a backslash as an
- # escape character.
- $str =3D~ s/\\/\\\\/g;
+ if (! defined $data_type
+ || $data_type !=3D DBI::SQL_INTEGER
+ || $data_type !=3D DBI::SQL_SMALLINT
+ || $data_type !=3D DBI::SQL_DECIMAL
+ || $data_type !=3D DBI::SQL_FLOAT
+ || $data_type !=3D DBI::SQL_REAL
+ || $data_type !=3D DBI::SQL_DOUBLE
+ || $data_type !=3D DBI::SQL_NUMERIC)
+ {
+ $str =3D~ s/(['\\\0])/$esc{$&}/g;
return "'$str'";
}
-
- # Optimise for standard numerics which need no quotes
- return $str if $data_type =3D=3D DBI::SQL_INTEGER
- || $data_type =3D=3D DBI::SQL_SMALLINT
- || $data_type =3D=3D DBI::SQL_DECIMAL
- || $data_type =3D=3D DBI::SQL_FLOAT
- || $data_type =3D=3D DBI::SQL_REAL
- || $data_type =3D=3D DBI::SQL_DOUBLE
- || $data_type =3D=3D DBI::SQL_NUMERIC;
- my $ti =3D $dbh->type_info($data_type);
- # XXX needs checking
- my $lp =3D $ti ? $ti->{LITERAL_PREFIX} || "" : "'";
- my $ls =3D $ti ? $ti->{LITERAL_SUFFIX} || "" : "'";
- # XXX don't know what the standard says about escaping
- # in the 'general case' (where $lp !=3D "'").
- # So we just do this and hope:
- $str =3D~ s/$lp/$lp$lp/g=20=20
- if $lp && $lp eq $ls && ($lp eq "'" || $lp eq '"');
- # also, escape the backslashes, always
- $str =3D~ s/\\/\\\\/g;
- # if the type is SQL_BINARY, escape the non-printable chars
- if ($data_type =3D=3D DBI::SQL_BINARY ||
- $data_type =3D=3D DBI::SQL_VARBINARY ||
- $data_type =3D=3D DBI::SQL_LONGVARBINARY) {
- $str=3Djoin("", map { isprint($_)?$_:'\\'.sprintf("%03o",ord($=
_)) }=20
- split //, $str);
- }
- return "$lp$str$ls";
+ return $str;
}
}
-
=20
{ package DBD::Pg::st; # =3D=3D=3D=3D=3D=3D STATEMENT =3D=3D=3D=3D=3D=3D
=20
--=-GN/UeNODcasng/+vVZrj
Content-Type: text/plain
Content-Disposition: inline
Content-Transfer-Encoding: binary
MIME-Version: 1.0
---------------------------(end of broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to [EMAIL PROTECTED]
--=-GN/UeNODcasng/+vVZrj--
>From [EMAIL PROTECTED] Sun Nov 18
>15:47:48 2001
Return-path: <[EMAIL PROTECTED]>
Received: from rs.postgresql.org (server1.pgsql.org [64.39.15.238] (may be forged))
by candle.pha.pa.us (8.11.6/8.10.1) with ESMTP id fAILllv09076
for <[EMAIL PROTECTED]>; Sun, 18 Nov 2001 16:47:47 -0500 (EST)
Received: from postgresql.org (postgresql.org [64.49.215.8])
by rs.postgresql.org (8.11.6/8.11.6) with ESMTP id fAILjLN77206
for <[EMAIL PROTECTED]>; Sun, 18 Nov 2001 15:45:21 -0600 (CST)
(envelope-from
[EMAIL PROTECTED])
Received: from mercury.atomicode.com (dnai-216-15-61-5.cust.dnai.com [216.15.61.5])
by postgresql.org (8.11.3/8.11.4) with ESMTP id fAILYSm99697
for <[EMAIL PROTECTED]>; Sun, 18 Nov 2001 16:34:28 -0500 (EST)
(envelope-from [EMAIL PROTECTED])
Received: from mercury (IDENT:david@mercury [127.0.0.1])
by mercury.atomicode.com (8.11.6/8.11.6) with ESMTP id fAILXt901104;
Sun, 18 Nov 2001 13:33:55 -0800
Subject: Re: [GENERAL] DBD::Pg BYTEA Character Escaping
From: David Wheeler <[EMAIL PROTECTED]>
To: Alex Pilosov <[EMAIL PROTECTED]>
cc: [EMAIL PROTECTED]
In-Reply-To: <[EMAIL PROTECTED]>
References: <[EMAIL PROTECTED]>
Content-Type: text/plain
Content-Transfer-Encoding: 7bit
X-Mailer: Evolution/0.99.0 (Preview Release)
Date: 18 Nov 2001 13:33:55 -0800
Message-ID: <[EMAIL PROTECTED]>
MIME-Version: 1.0
Precedence: bulk
Sender: [EMAIL PROTECTED]
Status: OR
On Sun, 2001-11-18 at 08:40, Alex Pilosov wrote:
> I didn't say it was needed :) I just had the easy way out and escaped
> everything that might possibly need to be escaped.
Ah, gotcha!
<snip />
> > So, the reason I'm posting this query is because I'd like to get
> > confirmation, if possible, on this conclusion. Based on the feedback I
> > receive, I will submit patches to the DBD::Pg maintainer.
> Go right ahead.
Thanks. See other recent messages with patches attached.
Regards,
David
--
David Wheeler AIM: dwTheory
[EMAIL PROTECTED] ICQ: 15726394
Yahoo!: dew7e
Jabber: [EMAIL PROTECTED]
---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?
http://archives.postgresql.org
>From [EMAIL PROTECTED] Sun Nov 18
>15:48:11 2001
Return-path: <[EMAIL PROTECTED]>
Received: from rs.postgresql.org (server1.pgsql.org [64.39.15.238] (may be forged))
by candle.pha.pa.us (8.11.6/8.10.1) with ESMTP id fAILmAv09112
for <[EMAIL PROTECTED]>; Sun, 18 Nov 2001 16:48:10 -0500 (EST)
Received: from postgresql.org (postgresql.org [64.49.215.8])
by rs.postgresql.org (8.11.6/8.11.6) with ESMTP id fAILkAN77212
for <[EMAIL PROTECTED]>; Sun, 18 Nov 2001 15:46:10 -0600 (CST)
(envelope-from
[EMAIL PROTECTED])
Received: from mercury.atomicode.com (dnai-216-15-61-5.cust.dnai.com [216.15.61.5])
by postgresql.org (8.11.3/8.11.4) with ESMTP id fAILaCm99753
for <[EMAIL PROTECTED]>; Sun, 18 Nov 2001 16:36:12 -0500 (EST)
(envelope-from [EMAIL PROTECTED])
Received: from mercury (IDENT:david@mercury [127.0.0.1])
by mercury.atomicode.com (8.11.6/8.11.6) with ESMTP id fAILaD901120;
Sun, 18 Nov 2001 13:36:14 -0800
Subject: Re: [GENERAL] DBD::Pg BYTEA Character Escaping
From: David Wheeler <[EMAIL PROTECTED]>
To: Tom Lane <[EMAIL PROTECTED]>
cc: [EMAIL PROTECTED]
In-Reply-To: <[EMAIL PROTECTED]>
References: <[EMAIL PROTECTED]>
<[EMAIL PROTECTED]>
<[EMAIL PROTECTED]>
Content-Type: multipart/mixed; boundary="=-z6aKS4RtdTQsE5Msi7ut"
X-Mailer: Evolution/0.99.0 (Preview Release)
Date: 18 Nov 2001 13:36:13 -0800
Message-ID: <[EMAIL PROTECTED]>
MIME-Version: 1.0
Precedence: bulk
Sender: [EMAIL PROTECTED]
Status: OR
--=-z6aKS4RtdTQsE5Msi7ut
Content-Type: text/plain
Content-Transfer-Encoding: 7bit
On Sun, 2001-11-18 at 13:21, David Wheeler wrote:
> If you agree that this tack makes sense, I'll submit the patch to Edmund
> Mergl.
<snip />
Actually, I've come up with an even simpler solution, and it should be
faster for some datatypes, too. It's attached.
Thanks,
David
--
David Wheeler AIM: dwTheory
[EMAIL PROTECTED] ICQ: 15726394
Yahoo!: dew7e
Jabber: [EMAIL PROTECTED]
--=-z6aKS4RtdTQsE5Msi7ut
Content-Disposition: attachment; filename=DBD-Pg.diff
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain; charset=ISO-8859-1
--- /usr/local/lib/perl5/site_perl/5.6.1/ppc-linux/DBD/Pg.pm Wed Jun 27 10:=
54:58 2001
+++ bin/Pg.pm Sun Nov 18 13:31:00 2001
@@ -104,7 +104,17 @@
=20
{ package DBD::Pg::db; # =3D=3D=3D=3D=3D=3D DATABASE =3D=3D=3D=3D=3D=3D
use strict;
- use POSIX(qw(isprint)); # necessary for quote()
+
+ # Characters that need to be escaped by quote().
+ my %esc =3D ( "'" =3D> '\\047', # '\\' . sprintf("%03o", ord("'")), #=
ISO SQL 2
+ '\\' =3D> '\\134', # '\\' . sprintf("%03o", ord("\\")),
+ "\0" =3D> '\\000' # '\\' . sprintf("%03o", ord("\0")),
+ );
+
+ # Set up lookup for SQL types we don't want to escape.
+ my @no_escape;
+ grep { $no_escape[$_] =3D 1 } DBI::SQL_INTEGER, DBI::SQL_SMALLINT, DBI=
::SQL_DECIMAL,
+ DBI::SQL_FLOAT, DBI::SQL_REAL, DBI::SQL_DOUBLE, DBI::SQL_NUMERIC;
=20
sub prepare {
my($dbh, $statement, @attribs)=3D @_;
@@ -341,48 +351,13 @@
=20
sub quote {
my ($dbh, $str, $data_type) =3D @_;
-
return "NULL" unless defined $str;
=20
- unless ($data_type) {
- $str =3D~ s/'/''/g; # ISO SQL2
- # In addition to the DBI method it doubles also the
- # backslash, because PostgreSQL treats a backslash as an
- # escape character.
- $str =3D~ s/\\/\\\\/g;
- return "'$str'";
- }
-
- # Optimise for standard numerics which need no quotes
- return $str if $data_type =3D=3D DBI::SQL_INTEGER
- || $data_type =3D=3D DBI::SQL_SMALLINT
- || $data_type =3D=3D DBI::SQL_DECIMAL
- || $data_type =3D=3D DBI::SQL_FLOAT
- || $data_type =3D=3D DBI::SQL_REAL
- || $data_type =3D=3D DBI::SQL_DOUBLE
- || $data_type =3D=3D DBI::SQL_NUMERIC;
- my $ti =3D $dbh->type_info($data_type);
- # XXX needs checking
- my $lp =3D $ti ? $ti->{LITERAL_PREFIX} || "" : "'";
- my $ls =3D $ti ? $ti->{LITERAL_SUFFIX} || "" : "'";
- # XXX don't know what the standard says about escaping
- # in the 'general case' (where $lp !=3D "'").
- # So we just do this and hope:
- $str =3D~ s/$lp/$lp$lp/g=20=20
- if $lp && $lp eq $ls && ($lp eq "'" || $lp eq '"');
- # also, escape the backslashes, always
- $str =3D~ s/\\/\\\\/g;
- # if the type is SQL_BINARY, escape the non-printable chars
- if ($data_type =3D=3D DBI::SQL_BINARY ||
- $data_type =3D=3D DBI::SQL_VARBINARY ||
- $data_type =3D=3D DBI::SQL_LONGVARBINARY) {
- $str=3Djoin("", map { isprint($_)?$_:'\\'.sprintf("%03o",ord($=
_)) }=20
- split //, $str);
- }
- return "$lp$str$ls";
+ return $str if $data_type && $no_escape[$data_type];
+ $str =3D~ s/(['\\\0])/$esc{$&}/g;
+ return "'$str'";
}
}
-
=20
{ package DBD::Pg::st; # =3D=3D=3D=3D=3D=3D STATEMENT =3D=3D=3D=3D=3D=3D
=20
--=-z6aKS4RtdTQsE5Msi7ut
Content-Type: text/plain
Content-Disposition: inline
Content-Transfer-Encoding: binary
MIME-Version: 1.0
---------------------------(end of broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to [EMAIL PROTECTED]
--=-z6aKS4RtdTQsE5Msi7ut--
>From [EMAIL PROTECTED] Wed Jan 9 21:39:14 2002
Return-path: <[EMAIL PROTECTED]>
Received: from usbosmx01.guardent.com ([208.9.212.220])
by candle.pha.pa.us (8.11.6/8.10.1) with ESMTP id g0A3dDF17430
for <[EMAIL PROTECTED]>; Wed, 9 Jan 2002 22:39:13 -0500 (EST)
Received: by USBOSMX01 with Internet Mail Service (5.5.2653.19)
id <ZZH9GLLG>; Wed, 9 Jan 2002 22:40:09 -0500
Message-ID: <397E0659AA2DD411843500508B64F1CE0287DE20@USBOSMX01>
From: [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
cc: [EMAIL PROTECTED], [EMAIL PROTECTED], [EMAIL PROTECTED]
Subject: RE: [INTERFACES] [PATCH] notify support for DBD::Pg
Date: Wed, 9 Jan 2002 22:40:01 -0500
MIME-Version: 1.0
X-Mailer: Internet Mail Service (5.5.2653.19)
Content-Type: text/plain;
charset="ISO-8859-1"
Status: OR
Hey ya'll,
Sorry for any confusion. Here is the diff in context format.
Cheers,
Ben
diff -c -r DBD-Pg-1.01/Pg.pm DBD-Pg-1.01.ben/Pg.pm
*** DBD-Pg-1.01/Pg.pm Wed Jun 27 13:54:58 2001
--- DBD-Pg-1.01.ben/Pg.pm Wed Jan 9 18:40:04 2002
***************
*** 629,634 ****
--- 629,643 ----
dump a complete table. See test.pl for an example on how to use
this function.
+ $ret = $dbh->func('notifies');
+
+ Returns either undef or a reference to two-element array
+ [ $table, $backend_pid ] of asynchronous notifications received.
+
+ $fd = $dbh->func('getfd');
+
+ Returns fd of the actual connection to server. Can be used with
+ select() and func('notifies').
=back
diff -c -r DBD-Pg-1.01/Pg.xs DBD-Pg-1.01.ben/Pg.xs
*** DBD-Pg-1.01/Pg.xs Mon Jul 10 13:47:51 2000
--- DBD-Pg-1.01.ben/Pg.xs Wed Jan 9 18:40:04 2002
***************
*** 83,88 ****
--- 83,106 ----
}
void
+ getfd(dbh)
+ SV * dbh
+ CODE:
+ int ret;
+ D_imp_dbh(dbh);
+
+ ret = dbd_db_getfd(dbh, imp_dbh);
+ ST(0) = sv_2mortal( newSViv( ret ) );
+
+ void
+ notifies(dbh)
+ SV * dbh
+ CODE:
+ D_imp_dbh(dbh);
+
+ ST(0) = dbd_db_notifies(dbh, imp_dbh);
+
+ void
commit(dbh)
SV * dbh
CODE:
diff -c -r DBD-Pg-1.01/dbdimp.c DBD-Pg-1.01.ben/dbdimp.c
*** DBD-Pg-1.01/dbdimp.c Wed Jun 27 13:54:58 2001
--- DBD-Pg-1.01.ben/dbdimp.c Wed Jan 9 18:40:04 2002
***************
*** 197,202 ****
--- 197,243 ----
}
+ int
+ dbd_db_getfd (dbh, imp_dbh)
+ SV *dbh;
+ imp_dbh_t *imp_dbh;
+ {
+ char id;
+ SV* retsv;
+
+ if (dbis->debug >= 1) { fprintf(DBILOGFP, "dbd_db_getfd\n"); }
+
+ return PQsocket(imp_dbh->conn);
+ }
+
+ SV *
+ dbd_db_notifies (dbh, imp_dbh)
+ SV *dbh;
+ imp_dbh_t *imp_dbh;
+ {
+ char id;
+ PGnotify* notify;
+ AV* ret;
+ SV* retsv;
+
+ if (dbis->debug >= 1) { fprintf(DBILOGFP, "dbd_db_notifies\n"); }
+
+ PQconsumeInput(imp_dbh->conn);
+
+ notify = PQnotifies(imp_dbh->conn);
+
+ if (!notify) return &sv_undef;
+
+ ret=newAV();
+
+ av_push(ret, newSVpv(notify->relname,0) );
+ av_push(ret, newSViv(notify->be_pid) );
+
+ retsv = newRV(sv_2mortal((SV*)ret));
+
+ return retsv;
+ }
+
int
dbd_db_ping (dbh)
SV *dbh;
diff -c -r DBD-Pg-1.01/dbdimp.h DBD-Pg-1.01.ben/dbdimp.h
*** DBD-Pg-1.01/dbdimp.h Mon Apr 9 13:44:18 2001
--- DBD-Pg-1.01.ben/dbdimp.h Wed Jan 9 18:40:04 2002
***************
*** 70,73 ****
--- 70,75 ----
};
+ SV * dbd_db_notifies (SV *dbh, imp_dbh_t *imp_dbh);
+
/* end of dbdimp.h */
diff -c -r DBD-Pg-1.01/test.pl DBD-Pg-1.01.ben/test.pl
*** DBD-Pg-1.01/test.pl Sun May 27 10:10:13 2001
--- DBD-Pg-1.01.ben/test.pl Wed Jan 9 18:40:04 2002
***************
*** 40,46 ****
my $dsn_main = "dbi:Pg:dbname=$dbmain";
my $dsn_test = "dbi:Pg:dbname=$dbtest";
! my ($dbh0, $dbh, $sth);
#DBI->trace(3); # make your choice
--- 40,46 ----
my $dsn_main = "dbi:Pg:dbname=$dbmain";
my $dsn_test = "dbi:Pg:dbname=$dbtest";
! my ($dbh0, $dbh, $dbh1, $sth);
#DBI->trace(3); # make your choice
***************
*** 445,460 ****
# end transaction
$dbh->{AutoCommit} = 1;
( $dbh->func($lobjId, 'lo_unlink') )
and print "\$dbh->func(lo_unlink) ...... ok\n"
or print "\$dbh->func(lo_unlink) ...... not ok\n";
- # compare large objects
-
( $pgin cmp $buf and $pgin cmp $blob )
and print "compare blobs .............. not ok\n"
or print "compare blobs .............. ok\n";
######################### disconnect and drop test database
# disconnect
--- 445,500 ----
# end transaction
$dbh->{AutoCommit} = 1;
+ # compare large objects
+
( $dbh->func($lobjId, 'lo_unlink') )
and print "\$dbh->func(lo_unlink) ...... ok\n"
or print "\$dbh->func(lo_unlink) ...... not ok\n";
( $pgin cmp $buf and $pgin cmp $blob )
and print "compare blobs .............. not ok\n"
or print "compare blobs .............. ok\n";
+ my $fd;
+ ( $fd=$dbh->func( 'getfd') )
+ and print "\$dbh->func(getfd) .......... ok\n"
+ or print "\$dbh->func(getfd) .......... not ok\n";
+
+ ( $dbh->do( 'LISTEN test ') )
+ and print "\$dbh->do('LISTEN test') .... ok\n"
+ or print "\$dbh->do('LISTEN test') .... not ok\n";
+
+ ( $dbh1 = DBI->connect("$dsn_test", '', '', { AutoCommit => 1 }) )
+ and print "DBI->connect (for notify)... ok\n"
+ or die "DBI->connect (for notify)... not ok: ", $DBI::errstr;
+
+ # there should be no data for read on $fd , until we send a notify
+
+ my $rout;
+ my $rin = '';
+ vec($rin,$fd,1) = 1;
+ my $nfound = select( $rout=$rin, undef, undef, 0);
+
+ ( $nfound==0 )
+ and print "select(\$fd) returns no data. ok\n"
+ or die "select(\$fd) returns no data. not ok\n";
+
+ ( $dbh1->do( 'NOTIFY test ') )
+ and print "\$dbh1->do('NOTIFY test') ... ok\n"
+ or print "\$dbh1->do('NOTIFY test') ... not ok\n";
+
+ my $nfound2 = select( $rout=$rin, undef, undef, 1);
+
+ ( $nfound2==1 )
+ and print "select(\$fd) returns data.... ok\n"
+ or die "select(\$fd) returns data.... not ok\n";
+
+ my $notify_r;
+
+ ( $notify_r = $dbh->func('notifies') )
+ and print "\$dbh->func('notifies')...... ok\n"
+ or die "\$dbh->func('notifies')...... not ok\n";
+
######################### disconnect and drop test database
# disconnect
***************
*** 463,468 ****
--- 503,512 ----
and print "\$dbh->disconnect ........... ok\n"
or die "\$dbh->disconnect ........... not ok: ", $DBI::errstr;
+ ( $dbh1->disconnect )
+ and print "\$dbh1->disconnect .......... ok\n"
+ or die "\$dbh1->disconnect .......... not ok: ", $DBI::errstr;
+
$dbh0->do("DROP DATABASE $dbtest");
$dbh0->disconnect;
-----Original Message-----
From: Bruce Momjian [mailto:pgman@;candle.pha.pa.us]
Sent: Wednesday, January 09, 2002 7:29 PM
To: Ben Feinstein
Cc: [EMAIL PROTECTED]; [EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject: Re: [INTERFACES] [PATCH] notify support for DBD::Pg
[EMAIL PROTECTED] wrote:
> Hey ya'll,
>
> Attached is a patch to add support for asynchronous client notifications
to
> the DBD::Pg interface. The original patch was written by Alex Pilosov
> <[EMAIL PROTECTED]> and sent to this list on 10 Jun 2001. This is an
updated
> version that fixes some problems I encountered when running Alex's patch
> against DBD-Pg-1.01. Alex's original patch was generated from a diff of
> DBD-Pg-1.00.
We really need a context diff, diff -c.
--
Bruce Momjian | http://candle.pha.pa.us
[EMAIL PROTECTED] | (610) 853-3000
+ If your life is a hard drive, | 830 Blythe Avenue
+ Christ can be your backup. | Drexel Hill, Pennsylvania 19026
>From [EMAIL PROTECTED] Wed Feb 20 05:00:20 2002
Return-path: <[EMAIL PROTECTED]>
Received: from mailout03.sul.t-online.com (mailout03.sul.t-online.com [194.25.134.81])
by candle.pha.pa.us (8.11.6/8.10.1) with ESMTP id g1KB0JQ13227
for <[EMAIL PROTECTED]>; Wed, 20 Feb 2002 06:00:19 -0500 (EST)
Received: from fwd06.sul.t-online.de
by mailout03.sul.t-online.com with smtp
id 16dUGP-0001nH-05; Wed, 20 Feb 2002 11:46:17 +0100
Received: from sls-isdn.s.bawue.de (520078144162-0001@[217.230.23.112]) by
fmrl06.sul.t-online.com
with esmtp id 16dUGB-1sdD7IC; Wed, 20 Feb 2002 11:46:03 +0100
Received: from bawue.de (sls-1.s.bawue.de [193.197.12.219])
by sls-isdn.s.bawue.de (8.11.6/8.11.6) with ESMTP id g1KAgtp00521;
Wed, 20 Feb 2002 11:42:58 +0100
Message-ID: <[EMAIL PROTECTED]>
Date: Wed, 20 Feb 2002 11:50:42 +0100
From: Edmund Mergl <[EMAIL PROTECTED]>
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:0.9.2.1) Gecko/20010901
X-Accept-Language: en-us
MIME-Version: 1.0
To: Bruce Momjian <[EMAIL PROTECTED]>
Subject: Re: [GENERAL] DBD::Pg errstr method doesn't return full error messages
References: <[EMAIL PROTECTED]>
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit
X-Sender: [EMAIL PROTECTED]
Status: ORr
Bruce Momjian wrote:
> Edmund Mergl wrote:
>
>>Bruce Momjian wrote:
>>
>>>>Bruce Momjian wrote:
>>>>
>>>>>Has this gotten back to the DBD Perl maintainers?
>>>>>
>>>>>
>>>>yes, I just want to to apply some more patches,
>>>>before releasing the next version.
>>>>
>>>Edmund, I haven't heard any comment from you on rolling the DBD driver
>>>into the PostgreSQL CVS tree. Do you like the idea?
>>>
>>>--
>>> Bruce Momjian | http://candle.pha.pa.us
>>> [EMAIL PROTECTED] | (610) 853-3000
>>> + If your life is a hard drive, | 830 Blythe Avenue
>>> + Christ can be your backup. | Drexel Hill, Pennsylvania 19026
>>>
>>
>>not really, most of the patches I got in the past where incomplete,
>>some even wrong. Anyway, my time is limited, so this might be a good idea.
>>
>>A long time ago, I had a telnet account on hub.org ? I don't remember.
>>Can you help me to add the sources to the cvs ?
>>
>
> Edmund, with 7.2 out the door, I can easily add your perl stuff to CVS.
> That way, we can help you apply patches with your OK. Can you send me a
> tarball?
>
>
Hi Bruce,
I would prefer, if someone else would take over the maintenance
including CPAN. Any ideas who could be interested ?
Edmund
--
http://www.edmund-mergl.de
fon: +49 700 edemergl
>From [EMAIL PROTECTED] Thu Aug 1 14:17:30 2002
Return-path: <[EMAIL PROTECTED]>
Received: from mx01.nexgo.de (mx01.nexgo.de [151.189.8.96])
by candle.pha.pa.us (8.11.6/8.10.1) with ESMTP id g71IHSZ16986
for <[EMAIL PROTECTED]>; Thu, 1 Aug 2002 14:17:29 -0400 (EDT)
Received: from sls-isdn.s.bawue.de (dsl-213-023-054-127.arcor-ip.net [213.23.54.127])
by mx01.nexgo.de (Postfix) with ESMTP
id BE2033BE9A; Thu, 1 Aug 2002 20:17:22 +0200 (CEST)
Received: from bawue.de (workstation [192.168.11.95])
by sls-isdn.s.bawue.de (8.11.6/8.11.6) with ESMTP id g71I8Xa10227;
Thu, 1 Aug 2002 20:08:34 +0200
Message-ID: <[EMAIL PROTECTED]>
Date: Thu, 01 Aug 2002 20:17:38 +0200
From: Edmund Mergl <[EMAIL PROTECTED]>
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:0.9.9) Gecko/20020513
X-Accept-Language: en-us, en
MIME-Version: 1.0
To: Bruce Momjian <[EMAIL PROTECTED]>
cc: "Andreas J. Koenig" <[EMAIL PROTECTED]>
Subject: Re: [GENERAL] DBD::Pg errstr method doesn't return full error
messages
References: <[EMAIL PROTECTED]>
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit
Status: ORr
Bruce Momjian wrote:
>
>
> Edmund, I will do CPAN for you. OK?
>
Hi Bruce,
that's ok with me.
Edmund
--
http://www.edmund-mergl.de
fon: +49 711 7456112
>From [EMAIL PROTECTED] Thu Aug 1 16:04:01 2002
Return-path: <[EMAIL PROTECTED]>
Received: from bender.bawue.de (bender.bawue.de [193.197.13.1])
by candle.pha.pa.us (8.11.6/8.10.1) with ESMTP id g71K40Z24264
for <[EMAIL PROTECTED]>; Thu, 1 Aug 2002 16:04:01 -0400 (EDT)
Received: from my.bawue.de (bender.bawue.de [193.197.13.1])
by bender.bawue.de (Postfix) with SMTP id 69D0B48F72
for <[EMAIL PROTECTED]>; Thu, 1 Aug 2002 22:06:59 +0200 (CEST)
MIME-Version: 1.0
Subject: Re: [GENERAL] DBD::Pg errstr method doesn't return full error messages
To: [EMAIL PROTECTED]
Reply-To: [EMAIL PROTECTED]
X-Mailer: AeroMail (http://the.cushman.net/projects/aeromail/)
Message-ID: <[EMAIL PROTECTED]>
Date: Thu, 1 Aug 2002 22:06:59 +0200 (CEST)
From: [EMAIL PROTECTED]
Status: ORr
> Edmund Mergl wrote:
> > Bruce Momjian wrote:
> > >
> > >
> > > Edmund, I will do CPAN for you. OK?
> > >
> >
> >
> > Hi Bruce,
> >
> > that's ok with me.
>
> Thanks. Is the most recent version on cpan?
yes
Edmund
>From [EMAIL PROTECTED] Thu Aug 22 15:10:32 2002
Return-path: <[EMAIL PROTECTED]>
Received: from postgresql.org (postgresql.org [64.49.215.8])
by candle.pha.pa.us (8.11.6/8.10.1) with ESMTP id g7MJAVs04175
for <[EMAIL PROTECTED]>; Thu, 22 Aug 2002 15:10:32 -0400 (EDT)
Received: from localhost (postgresql.org [64.49.215.8])
by postgresql.org (Postfix) with ESMTP
id C512F475E6D; Thu, 22 Aug 2002 15:10:30 -0400 (EDT)
Received: from postgresql.org (postgresql.org [64.49.215.8])
by postgresql.org (Postfix) with SMTP
id E0000475D8E; Thu, 22 Aug 2002 15:10:27 -0400 (EDT)
Received: from localhost (postgresql.org [64.49.215.8])
by postgresql.org (Postfix) with ESMTP id 29D9247580B
for <[EMAIL PROTECTED]>; Thu, 22 Aug 2002 15:10:19 -0400 (EDT)
Received: from earth.hub.org (earth.hub.org [64.49.215.11])
by postgresql.org (Postfix) with ESMTP id EAD7E47545C
for <[EMAIL PROTECTED]>; Thu, 22 Aug 2002 15:10:17 -0400 (EDT)
Received: from earth.hub.org (earth.hub.org [64.49.215.11])
by earth.hub.org (Postfix) with ESMTP
id 591142CCA9A; Thu, 22 Aug 2002 16:10:17 -0300 (ADT)
Date: Thu, 22 Aug 2002 16:10:17 -0300 (ADT)
From: "Marc G. Fournier" <[EMAIL PROTECTED]>
To: Neil Conway <[EMAIL PROTECTED]>
cc: [EMAIL PROTECTED]
Subject: Re: [HACKERS] DBD::Pg ...
In-Reply-To: <[EMAIL PROTECTED]>
Message-ID: <[EMAIL PROTECTED]>
MIME-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII
X-Virus-Scanned: by AMaViS new-20020517
Precedence: bulk
Sender: [EMAIL PROTECTED]
X-Virus-Scanned: by AMaViS new-20020517
Status: ORr
On 22 Aug 2002, Neil Conway wrote:
> "Marc G. Fournier" <[EMAIL PROTECTED]> writes:
> > Just got a note from Jeffrey on this, and he acknowledges that he is
> > continuing to maintain DBD::Pg through CPAN, so we won't be moving it to
> > GBorg ...
>
> Ok. Are there plans to remove interfaces/perl5 from the CVS tree?
Yes ... that will be moved over to GBorg similar to libpq++ ... Bruce, can
you create a projet for that as well? maybe call it pg-perl?
---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?
http://archives.postgresql.org