88171.net

bugs(?) in `Pg' perl module

I found some bugs(?) in perl module `Pg', test.pl. I'm not a PostgreSQL guru, so never sure that these fixes are correct...

* test.pl.orig        2000-04-05 04:30:39.000000000 +0900
+ test.pl     2010-03-29 22:52:32.000000000 +0900
@@ -96,9 +96,9 @@

 my $Option_ref = Pg::conndefaults();
 my ($key, $val);
*( $$Option_ref{port} ne "" && $$Option_ref{dbname} ne "" && $$Option_ref{user} ne "" )
+( $$Option_ref{port} ne "" && $$Option_ref{dbname} eq "" && $$Option_ref{user} ne "" )
     and print "Pg::conndefaults ........ ok\n"
*    or  die   "Pg::conndefaults ........ not ok: ", $conn->errorMessage;
+    or  die   "Pg::conndefaults ........ not ok";

 $conn = Pg::connectdb("dbname=$dbmain");
 ( PGRES_CONNECTION_OK eq $conn->status )
@@ -114,7 +114,7 @@
     or  die   "\$conn->exec ............. not ok: ", $conn->errorMessage;

 $conn = Pg::connectdb("dbname=rumpumpel");
*( $conn->errorMessage =~ /Database .?rumpumpel.? does not exist/ )
+( $conn->errorMessage =~ /Database .?rumpumpel.? does not exist/i )
     and print "\$conn->errorMessage ..... ok\n"
     or  die   "\$conn->errorMessage ..... not ok: ", $conn->errorMessage;

@@ -150,7 +150,7 @@
 $result = $conn->exec("CREATE TABLE person (id int4, name char(16))");
 die $conn->errorMessage unless PGRES_COMMAND_OK eq $result->resultStatus;
 my $cmd = $result->cmdStatus;
*( "CREATE" eq $cmd )
+( "CREATE" eq $cmd || "CREATE TABLE" eq $cmd )
     and print "\$conn->cmdStatus ........ ok\n"
     or  print "\$conn->cmdStatus ........ not ok: $cmd\n";