Bug 174373
Summary: | Perl program crashes on end if prepared statements are used | ||
---|---|---|---|
Product: | [Fedora] Fedora | Reporter: | Peter Bieringer <pb> |
Component: | perl-DBD-Pg | Assignee: | Jason Vas Dias <jvdias> |
Status: | CLOSED NOTABUG | QA Contact: | |
Severity: | medium | Docs Contact: | |
Priority: | medium | ||
Version: | 4 | CC: | perl-devel |
Target Milestone: | --- | ||
Target Release: | --- | ||
Hardware: | i386 | ||
OS: | Linux | ||
Whiteboard: | |||
Fixed In Version: | Doc Type: | Bug Fix | |
Doc Text: | Story Points: | --- | |
Clone Of: | Environment: | ||
Last Closed: | 2006-02-20 23:37:24 UTC | Type: | --- |
Regression: | --- | Mount Type: | --- |
Documentation: | --- | CRM: | |
Verified Versions: | Category: | --- | |
oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |
Cloudforms Team: | --- | Target Upstream Version: | |
Embargoed: |
Description
Peter Bieringer
2005-11-28 16:58:28 UTC
I forgot to mentionend, that if I connect to database with "pg_server_prepare => 0", also no crash occurs. So problem mut be related to the new feature of PostgreSQL 7.4/8.0. Hi - sorry for the delay in processing this bug. I've tried to reproduce the problem, with perl-5.8.6-16, perl-DBD-Pg-1.41-2 and postgresql-8.0.4-2.FC4.1 installed, using this example program: --- #!/usr/bin/perl use DBI; use DBD::Pg; $dbh = DBI->connect('dbi:Pg:dbname=test;', 'root', '', { pg_server_prepare => 1 } ) || die("can't connect: $! $?"); my $stmt = $dbh->prepare("SELECT * FROM t WHERE c = ?"); $stmt->{pg_server_prepare}=1; my $rv = $stmt->execute("A"); while (my $data = $stmt->fetchrow_hashref) { print join(" ",values %{$data}),"\n"; }; $stmt->finish(); $dbh->disconnect(); print "STILL HERE\n"; --- In all cases, this program completes normally and prints out "STILL HERE" . I've tried: o running the program on FC5 with perl-5.8.7-0.8.fc5, perl-DBD-Pg-1.43-2, postgresql-8.1.0-4 o running the program with or without { pg_server_prepare => 1 } in the connect o running the program with or without $stmt->{pg_server_prepare}=1; o running the program with or without $stmt->finish ; o using 'undef $stmt' instead of $stmt->finish ; o connecting to a remote postgresql-8.1.0-4 server instead of the local server If you can still reproduce this problem, please send me an example program such as the above (and possibly an example database dump) which exhibits the problem - otherwise I'll have to close as NOTABUG - thanks . I still cannot reproduce this problem. As no further information was forthcoming, closing as NOTABUG . Sorry, was busy, but I've tracked it more down by reducing my crashing program to the essential code and can now reproduce this using your example. -my $stmt = $dbh->prepare("SELECT * FROM t WHERE c = ?"); +my $stmt; + +sub prepare_statements() { + $stmt = $dbh->prepare("SELECT * FROM t WHERE c = ?"); +}; $stmt->{pg_server_prepare}=1; +prepare_statements(); + So the reason is that the statements are prepared in a subroutine and not undefined before program ends. Forgot to mention that upper modifications are required to cause the crash... I still really cannot reproduce this bug, using the following program, modified as you suggested: --- #!/usr/bin/perl use DBI; use DBD::Pg; ($host,$db,$user)=($ARGV[1],$ARGV[2]); $dbh = DBI->connect('dbi:Pg:dbname=$db;host=$host;', $user, '', { pg_server_prepare => 1 } ) || die("can't connect: $! $?"); my $stmt; sub prepare_stmt { $stmt = $dbh->prepare("SELECT * FROM t WHERE c = ?"); } $stmt->{pg_server_prepare}=1; prepare_stmt(); my $rv = $stmt->execute("A"); while (my $data = $stmt->fetchrow_hashref) { print join(" ",values %{$data}),"\n"; }; --- NOTE: The '$stmt->{pg_server_prepare}=1;' statement has no effect. The program above runs without errors and exits with 0 exit status. Concluding that this is 'NOTABUG'. If you can still reproduce this problem, please append the complete perl program that causes the bug, and a pg_dump(1) of the database the program connects to when the problem occurs, and re-open this bug - thanks. |