[pgsql-jp: 32076] Re: PostgreSQL7.4.1+pgperl2.0.2

Takashi Naito naitotk @ mars.dti.ne.jp
2004年 1月 21日 (水) 14:35:21 JST


内藤です。
確認の為PostgreSQLを7.3.5にして追試してみました。

----
postgres# make test
PERL_DL_NONLAZY=1 /usr/bin/perl -Iblib/arch -Iblib/lib -I/usr/libdata/perl/5.00503/mach -I/usr/libdata/perl/5.00503 test.pl
Pg::conndefaults ........ ok
Pg::connectdb ........... ok
ERROR:  DROP DATABASE: database "pgperltest" does not exist
$conn->exec ............. ok
FATAL:  Database "rumpumpel" does not exist in the system catalog.
$conn->errorMessage ..... ok
$conn->db ............... ok
$conn->user ............. ok
$conn->port ............. ok
$conn->cmdStatus ........ ok
$conn->oidStatus ........ ok
$conn->getline .......... ok
$conn->endcopy .......... ok
$result->cmdTuples ...... ok
$result->fname .......... ok
$result->ftype .......... ok
$result->fsize .......... ok
$result->fnumber ........ ok
$result->fetchrow ....... ok
test sequence finished.
----

う〜ん、問題ないですね・・・
で、終わっても何なのでちょっと調べてみました。

Pg::conndefaultsの返す値と、エラーメッセージが違う様なのでその辺りを探っ
たところ7.4.1でも通る様になりました。
ただ$$Option_ref{dbname}が何も返ってこなくて良いのかどうかは判りません。

一応diffの内容付けておきますが、7.3系列では逆にエラーになるでしょう。



--- test.pl.org Wed Jan 21 13:42:11 2004
+++ test.pl     Wed Jan 21 14:11:52 2004
@@ -96,9 +96,10 @@

 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} 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->errorMessage;

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

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



----------------------------------------------------------------------
   内 藤 貴 志  <naitotk @ mars.dti.ne.jp>
   @Nifty ID : CQK00312





pgsql-jp メーリングリストの案内