Thread: DBD::Pg's $dbh->func( "/path/to/file", 'lo_import' ) fails silently
Re: DBD::Pg's $dbh->func( "/path/to/file", 'lo_import' ) fails silently
I would suggest you join the Perl DBI mailing list and ask your question there. There are some quite capable people in that group who could help you troubleshoot this issue.
It’s called dbi-users@perl.org. Look at http://lists.cpan.org/showlist.cgi?name=dbi-users, where it tells you how to subscribe.
-Will
From: pgsql-general-owner@postgresql.org [mailto:pgsql-general-owner@postgresql.org] On Behalf Of Kynn Jones
Sent: 18 March 2009 12:01
To: pgsql-general General
Subject: [GENERAL] DBD::Pg's $dbh->func( "/path/to/file", 'lo_import' ) fails silently
I'm trying to use Perl's DBD::Pg module to import a file as a large object. For this I'm using the following:
my $oid = $dbh->func( "/absolute/path/to/file", 'lo_import' );
When I do this, a new record is added to pg_largeobject, with a proper-looking non-null loid, but the data field remains empty, and the variable $oid above gets a return value of undef, i.e. the call to func fails. No error warning is ever emitted, as far as I can tell. ($dbh->errstr returns undef.) FWIW, the file passed as the first argument is world-readable, and the full path to it is world-accessible.
I've read the documentation for Perl's DBI and DBD::Pg modules, but I can't find any information that will enable me to troubleshoot/debug this further. Any suggestions would be greatly appreciated!
TIA!
Kynn
Re: DBD::Pg`s $dbh->func( "/path/to/file", `lo_import` ) fails silently
-----BEGIN PGP SIGNED MESSAGE----- Hash: RIPEMD160 > I'm trying to use Perl's DBD::Pg module to import a file as a large object. > For this I'm using the following: > my $oid = $dbh->func( "/absolute/path/to/file", 'lo_import' ); Works fine for me. What version of DBD::Pg are you using? Try something recent if you are using something old. You can also set the trace level to see what's going on behind the scenes: $dbh->trace(10) If you can't get it to work, please send a small, self-contained script that duplicates the problem. - -- Greg Sabino Mullane greg@turnstep.com End Point Corporation PGP Key: 0x14964AC8 200903181557 http://biglumber.com/x/web?pk=2529DF6AB8F79407E94445B4BC9B906714964AC8 -----BEGIN PGP SIGNATURE----- iEYEAREDAAYFAknBUioACgkQvJuQZxSWSshmiQCfUQd1PJd+25t2quxvPXrKWFb5 7HIAn00Hw9MnonU6UL6/jT2U6JTHMjr3 =hMhf -----END PGP SIGNATURE-----
-----BEGIN PGP SIGNED MESSAGE-----
Hash: RIPEMD160
> I'm trying to use Perl's DBD::Pg module to import a file as a large object.
> For this I'm using the following:
> my $oid = $dbh->func( "/absolute/path/to/file", 'lo_import' );
Works fine for me. What version of DBD::Pg are you using? Try something
recent if you are using something old. You can also set the trace
level to see what's going on behind the scenes:
$dbh->trace(10)
Re: DBD::Pg's $dbh->func( "/path/to/file", 'lo_import' ) fails silently
-----BEGIN PGP SIGNED MESSAGE----- Hash: RIPEMD160 > Actually, after much trial and error I figured out the problem: the handle I > was using had AutoCommit set. I'm new to the lo_* functions, and not aware > of this issue. A mention of this in the DBD::Pg docs would be very helpful > to LO noobs like me. Ah, that clears things up. Definitely a multi-part bug on our part. I've updated the DBD::Pg docs to mention that the large object functions will not work if AutoCommit is enabled. The dbdpg code now throws an error if the functions are called while in the AutoCommit state. However, I also carved out exceptions for lo_import and lo_export: they are atomic, so no reason why they should not work even with AutoCommit! All of this will be in the next release of DBD::Pg, version 2.11.9, which should be released in the next few days. I also opened a bug for this, which is now the best place to track the issue: https://rt.cpan.org/Ticket/Display.html?id=44461 Thanks for reporting this and for following up once discovering the AutoCommit part. - -- Greg Sabino Mullane greg@turnstep.com End Point Corporation PGP Key: 0x14964AC8 200903220006 http://biglumber.com/x/web?pk=2529DF6AB8F79407E94445B4BC9B906714964AC8 -----BEGIN PGP SIGNATURE----- iEYEAREDAAYFAknFuhgACgkQvJuQZxSWSshcTACdH93UwJxRhF8WcXxcAjffecmw tzYAoMd7GvHBHrAXitro+r4QwRMkRDhS =iM63 -----END PGP SIGNATURE-----