libpq lo_open errors when first action in connection

Поиск
Список
Период
Сортировка
От Greg Sabino Mullane
Тема libpq lo_open errors when first action in connection
Дата
Msg-id 847778b18516dd1c0c001a6a2938b73e@biglumber.com
обсуждение исходный текст
Ответы Re: libpq lo_open errors when first action in connection  (Alvaro Herrera <alvherre@surnet.cl>)
Re: libpq lo_open errors when first action in connection  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1


I'm having some problems with lo_open inside of DBD::Pg (which
uses libpq) and need help in debugging the problem. The problem
is that a call to lo_open works perfectly, *unless* it is the
first thing that this connection to the database has done, in
which case it returns a -1 (which comes back to perl as undef).
To be more specific, I need to issue a "SELECT 123;" (or anything
else via PQexec) before the call will succeeed. All the parameters
to lo_open look normal and identical whether PQexec has been called
or not, and lo_creat always works just fine. It has to be PQexec*,
a prepare alone will not do the trick.

Here is a small sample code in Perl that demonstrates:

#!perl 
use DBI; use strict; use warnings; 
my $dbh = DBI->connect($ENV{DBI_DSN}, $ENV{DBI_USER}, '', {AutoCommit=>0, RaiseError=>1}); 
# If the below line is commented out, this test will fail:
$dbh->do("SELECT 123"); 
my $W = $dbh->{pg_INV_WRITE};
my $object = $dbh->func($W, 'lo_creat');
my $handle = $dbh->func($object, $W, 'lo_open');
printf "This test %s!\n", defined $handle ? "worked" : "did not work";
$dbh->disconnect;


Thanks,
- --
Greg Sabino Mullane greg@turnstep.com
PGP Key: 0x14964AC8 200505121009
http://biglumber.com/x/web?pk=2529DF6AB8F79407E94445B4BC9B906714964AC8
-----BEGIN PGP SIGNATURE-----

iD8DBQFCg2nKvJuQZxSWSsgRAoqxAJ4+jdYo+BrxHb0smXzU2FzOzPODHwCg/hZB
oHcq8t479a5OKaURCl8Kl5U=
=rmbL
-----END PGP SIGNATURE-----




В списке pgsql-hackers по дате отправления:

Предыдущее
От: Robert Treat
Дата:
Сообщение: Re: Views, views, views: Summary of Arguments
Следующее
От: Alvaro Herrera
Дата:
Сообщение: Re: PostgreSQL running out of file handles