Subject: | Bus error when fetching array columns on Mac OS X |
This script reproduces the bug:
---
#!/usr/bin/perl
use strict;
use DBI;
DBI->trace(5);
my $dbh = DBI->connect('dbi:Pg:dbname=test', 'someuser', 'somepass');
$dbh->do('CREATE TABLE t1 (nums INT[])');
$dbh->do("INSERT INTO t1 (nums) VALUES ('{4,5,6}')");
my $sth = $dbh->prepare('SELECT * FROM t1');
$sth->execute;
my $row = $sth->fetch;
---
Here's the output when I execute it.
---
DBI 1.50-nothread default trace level set to 0x0/5 (pid 7693)
Note: perl is running without the recommended perl -w option
-> DBI->connect(dbi:Pg:dbname=test, postgres, ****)
-> DBI->install_driver(Pg) for darwin perl=5.008008 pid=7693 ruid=501 euid=501
install_driver: DBD::Pg version 1.44 loaded from /usr/local/lib/perl5/site_perl/5.8.8/
darwin-2level/DBD/Pg.pm
New DBI::dr (for DBD::Pg::dr, parent=, id=)
dbih_setup_handle(DBI::dr=HASH(0x183c604)=>DBI::dr=HASH(0x1834124), DBD::Pg::dr,
0, Null!)
dbih_make_com(Null!, 0, DBD::Pg::dr, 84, 0) thr#0
dbih_setup_attrib(DBI::dr=HASH(0x1834124), Err, Null!) SCALAR(0x1833f2c) (already
defined)
dbih_setup_attrib(DBI::dr=HASH(0x1834124), State, Null!) SCALAR(0x1833ef0) (already
defined)
dbih_setup_attrib(DBI::dr=HASH(0x1834124), Errstr, Null!) SCALAR(0x1833f14) (already
defined)
dbih_setup_attrib(DBI::dr=HASH(0x1834124), TraceLevel, Null!) 0 (already defined)
dbih_setup_attrib(DBI::dr=HASH(0x1834124), FetchHashKeyName, Null!) 'NAME' (already
defined)
<- install_driver= DBI::dr=HASH(0x183c604)
!! warn: 0 CLEARED by call to default_user method
-> default_user in DBD::_::dr for DBD::Pg::dr (DBI::dr=HASH(0x183c604)~0x1834124
'postgres' undef HASH(0x1836938))
<- default_user= ( 'postgres' undef ) [2 items] at /usr/local/lib/perl5/site_perl/5.8.4/
darwin-2level/DBI.pm line 599 via new.pl line 8
-> connect for DBD::Pg::dr (DBI::dr=HASH(0x183c604)~0x1834124 'dbname=test'
'postgres' **** HASH(0x186af24))
New DBI::db (for DBD::Pg::db, parent=DBI::dr=HASH(0x1834124), id=)
dbih_setup_handle(DBI::db=HASH(0x1834058)=>DBI::db=HASH(0x186af54), DBD::Pg::db,
183c3a0, Null!)
dbih_make_com(DBI::dr=HASH(0x1834124), 316c60, DBD::Pg::db, 124, 0) thr#0
dbih_setup_attrib(DBI::db=HASH(0x186af54), Err, DBI::dr=HASH(0x1834124)) SCALAR
(0x1840b54) (already defined)
dbih_setup_attrib(DBI::db=HASH(0x186af54), State, DBI::dr=HASH(0x1834124)) SCALAR
(0x1840bb4) (already defined)
dbih_setup_attrib(DBI::db=HASH(0x186af54), Errstr, DBI::dr=HASH(0x1834124)) SCALAR
(0x1840b84) (already defined)
dbih_setup_attrib(DBI::db=HASH(0x186af54), TraceLevel, DBI::dr=HASH(0x1834124)) 0
(already defined)
dbih_setup_attrib(DBI::db=HASH(0x186af54), FetchHashKeyName, DBI::dr=HASH
(0x1834124)) 'NAME' (already defined)
dbih_setup_attrib(DBI::db=HASH(0x186af54), HandleSetErr, DBI::dr=HASH(0x1834124))
undef (not defined)
dbih_setup_attrib(DBI::db=HASH(0x186af54), HandleError, DBI::dr=HASH(0x1834124))
undef (not defined)
dbdpg: dbd_db_login
dbdpg: login connection string: (dbname=test user='postgres')
-> FETCH for DBD::Pg::db (DBI::db=HASH(0x186af54)~INNER 'pg_server_version')
dbdpg: dbd_db_FETCH (pg_server_version) dbh=25604032
<- FETCH= 80103 at /usr/local/lib/perl5/site_perl/5.8.8/darwin-2level/DBD/Pg.pm line
158 via new.pl line 8
-> FETCH for DBD::Pg::db (DBI::db=HASH(0x186af54)~INNER 'private_dbdpg')
dbdpg: dbd_db_FETCH (private_dbdpg) dbh=25604032
.. FETCH DBI::db=HASH(0x186af54) 'private_dbdpg' = undef
<- FETCH= undef at /usr/local/lib/perl5/site_perl/5.8.8/darwin-2level/DBD/Pg.pm line
159 via new.pl line 8
-> STORE for DBD::Pg::db (DBI::db=HASH(0x186af54)~INNER 'private_dbdpg' HASH
(0x186b044))
dbdpg: dbd_db_STORE (private_dbdpg) (1)
STORE DBI::db=HASH(0x186af54) 'private_dbdpg' => HASH(0x186b044)
<- STORE= 1 at /usr/local/lib/perl5/site_perl/5.8.8/darwin-2level/DBD/Pg.pm line 159
via new.pl line 8
<- connect= DBI::db=HASH(0x1834058) at /usr/local/lib/perl5/site_perl/5.8.4/
darwin-2level/DBI.pm line 617
-> STORE for DBD::Pg::db (DBI::db=HASH(0x186af54)~INNER 'PrintError' 1)
dbdpg: dbd_db_STORE (PrintError) (1)
STORE DBI::db=HASH(0x186af54) 'PrintError' => 1
<- STORE= 1 at /usr/local/lib/perl5/site_perl/5.8.4/darwin-2level/DBI.pm line 664
-> STORE for DBD::Pg::db (DBI::db=HASH(0x186af54)~INNER 'AutoCommit' 1)
dbdpg: dbd_db_STORE (AutoCommit) (1)
dbdpg: dbd_db_commit (AutoCommit is 0) (BegunWork is 0)
dbdpg: dbd_db_txn_status
dbdpg: Setting AutoCommit on forced a commit
<- STORE= 1 at /usr/local/lib/perl5/site_perl/5.8.4/darwin-2level/DBI.pm line 664
-> STORE for DBD::Pg::db (DBI::db=HASH(0x186af54)~INNER 'Username' 'postgres')
dbdpg: dbd_db_STORE (Username) (1)
STORE DBI::db=HASH(0x186af54) 'Username' => 'postgres'
<- STORE= 1 at /usr/local/lib/perl5/site_perl/5.8.4/darwin-2level/DBI.pm line 667 via
new.pl line 8
<> FETCH= 'postgres' ('Username' from cache) at /usr/local/lib/perl5/site_perl/5.8.4/
darwin-2level/DBI.pm line 667
<- connect= DBI::db=HASH(0x1834058)
-> STORE for DBD::Pg::db (DBI::db=HASH(0x186af54)~INNER 'dbi_connect_closure' CODE
(0x1856184))
dbdpg: dbd_db_STORE (dbi_connect_closure) (1)
STORE DBI::db=HASH(0x186af54) 'dbi_connect_closure' => CODE(0x1856184)
<- STORE= 1 at /usr/local/lib/perl5/site_perl/5.8.4/darwin-2level/DBI.pm line 683 via
new.pl line 8
-> do for DBD::Pg::db (DBI::db=HASH(0x1834058)~0x186af54 'CREATE TABLE t1 (nums
INT[])')
dbdpg: pg_quickexec (CREATE TABLE t1 (nums INT[]))
dbdpg: _sqlstate
dbdpg: pg_error (ERROR: relation "t1" already exists
) number=7
dbdpg: ERROR: relation "t1" already exists
error 7 recorded: ERROR: relation "t1" already exists
!! ERROR: 7 'ERROR: relation "t1" already exists
' (err#0)
<- do= undef at new.pl line 10
DBD::Pg::db do failed: ERROR: relation "t1" already exists
!! ERROR: 7 CLEARED by call to do method
-> do for DBD::Pg::db (DBI::db=HASH(0x1834058)~0x186af54 'INSERT INTO t1 (nums)
VALUES ('{4,5,6}')')
dbdpg: pg_quickexec (INSERT INTO t1 (nums) VALUES ('{4,5,6}'))
dbdpg: _sqlstate
<- do= 1 at new.pl line 11
-> prepare for DBD::Pg::db (DBI::db=HASH(0x1834058)~0x186af54 'SELECT * FROM t1')
New DBI::st (for DBD::Pg::st, parent=DBI::db=HASH(0x186af54), id=)
dbih_setup_handle(DBI::st=HASH(0x186afe4)=>DBI::st=HASH(0x186afcc), DBD::Pg::st,
186aff0, Null!)
dbih_make_com(DBI::db=HASH(0x186af54), 5135c0, DBD::Pg::st, 172, 0) thr#0
dbih_setup_attrib(DBI::st=HASH(0x186afcc), Err, DBI::db=HASH(0x186af54)) SCALAR
(0x1840b54) (already defined)
dbih_setup_attrib(DBI::st=HASH(0x186afcc), State, DBI::db=HASH(0x186af54)) SCALAR
(0x1840bb4) (already defined)
dbih_setup_attrib(DBI::st=HASH(0x186afcc), Errstr, DBI::db=HASH(0x186af54)) SCALAR
(0x1840b84) (already defined)
dbih_setup_attrib(DBI::st=HASH(0x186afcc), TraceLevel, DBI::db=HASH(0x186af54)) 0
(already defined)
dbih_setup_attrib(DBI::st=HASH(0x186afcc), FetchHashKeyName, DBI::db=HASH
(0x186af54)) 'NAME' (already defined)
dbih_setup_attrib(DBI::st=HASH(0x186afcc), HandleSetErr, DBI::db=HASH(0x186af54))
undef (not defined)
dbih_setup_attrib(DBI::st=HASH(0x186afcc), HandleError, DBI::db=HASH(0x186af54))
undef (not defined)
dbdpg: dbd_st_prepare (SELECT * FROM t1)
dbdpg: dbd_st_split_statement
dbdpg: Created segment (SELECT * FROM t1)
<- prepare= DBI::st=HASH(0x186afe4) at new.pl line 13
-> execute for DBD::Pg::st (DBI::st=HASH(0x186afe4)~0x186afcc)
dbdpg: dbd_st_execute
dbdpg: PQexec
dbdpg: Running PQexec with (SELECT * FROM t1)
dbdpg: _sqlstate
dbdpg: Status was PGRES_TUPLES_OK, fields=1, tuples=3
<- execute= 3 at new.pl line 14
-> fetch for DBD::Pg::st (DBI::st=HASH(0x186afe4)~0x186afcc)
dbdpg: dbd_st_fetch
dbih_setup_fbav for 1 fields => 0x186aee8
dbdpg: Fetching a field
Bus error
---
I'm running perl 5.8.8 with the latest CPAN versions of all modules. The bug happens with
both DBD::Pg 1.44 and DBD::Pg 1.45. My OS version:
% uname -a
Darwin yoshi 8.5.0 Darwin Kernel Version 8.5.0: Sun Jan 22 10:38:46 PST 2006;
root:xnu-792.6.61.obj~1/RELEASE_PPC Power Macintosh powerpc