DBD::Pg - BYTEA - fails for range outside chr(0)-chr(127)

Started by Randal L. Schwartzalmost 25 years ago2 messagesgeneral
Jump to latest
#1Randal L. Schwartz
merlyn@stonehenge.com

[Note, I'm not a member of this list (yet :), so cc me on any responses.
I posted this to the Perl-dbi list and they suggest I take it here.]

I'm getting core dumps when I try to use a BYTEA value with
a byte outside 0..127.

use DBI qw(SQL_BINARY);
my $dbh = DBI->connect("dbi:Pg:dbname=merlyntest", "user", "pass",
{ RaiseError => 1 });
$dbh->do("CREATE TABLE test (a BYTEA)");
my $insert = $dbh->prepare("INSERT INTO test VALUES (?)");
$insert->bind_param(1, undef, SQL_BINARY); # necessary for BYTEA escaping
$insert->execute("fred"); # works fine
$insert->execute(pack "C*", 0..127); # works fine
$insert->execute(pack "C*", 128); # BOMB, core dump

(I'm cutting and pasting this from a perl debugger session, so if
that's not quite it, forgive me.)

DBI version 1.18
DBD::Pg version 1.00
postgresql version 7.1.2
Perl version 5.5.3

Is it just me? Am I not holding my mouth right?

--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/&gt;
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!

#2Tom Lane
tgl@sss.pgh.pa.us
In reply to: Randal L. Schwartz (#1)
Re: DBD::Pg - BYTEA - fails for range outside chr(0)-chr(127)

merlyn@stonehenge.com (Randal L. Schwartz) writes:

$insert->execute(pack "C*", 128); # BOMB, core dump

Core dump where? A stack backtrace might help ...

regards, tom lane