dbiwrapper not using APIs for postgres 1.8
Brought to you by:
pcxuser
DBD::Pg::db last_insert_id failed: No suitable column found for last_insert_id of table "user_tb" at /usr/share/perl5/DBIWrapper.pm line 2520.
This error has been happening (with all tables--not just user_tb) since moving to pg 1.8 years ago. It doesn't stop the system from working so I've been ignoring it. I find it odd that you are still using dbiwrapper with pg 1.7 or not seeing this error yourself with 1.8.
I had added the following code which seems to suppress this error in my usage:
local $self->{dbh}->{PrintError}; # don't print an error when last_insert_id can't find the sequence on a table.
Are you still seeing that error with current CVS head?
Just checked out CVS and installed.
DBD::Pg::db last_insert_id failed: No suitable column found for last_insert_id of table "entity_tb" at /usr/local/share/perl/5.10.1/DBIWrapper.pm line 2520.
[Tue Dec 20 09:58:44 2011] [error] [client 192.168.3.120] Premature end of script headers: update_entity.cgi, referer: http://sandsurfer.dev/cgi-bin/add_entity.cgi
What versions of Perl, DBD::Pg and DBI are you using?
Ubuntu Server 10.04
Perl 5.10.1-8ubuntu2.1
libdbi-perl 1.609-1build1
libdbiwrapper-perl 0.24-7
libdbd-pg-perl 2.16.1-1
Are you sure that the newer version of DBIWrapper.pm is being picked up?
Did you build a deb via 'debuild -tc' or just do the perl Makefile.PL install process?
They don't install into the same paths.
I have slightly newer versions of DBI and DBD::Pg and also older versions of perl and DBI and DBD::Pg and the CVS head code change works properly on all of them to suppress the warning.
/usr/local/share/perl/5.10.1/DBIWrapper.pm line 2520.
Given that the error lists /usr/local/share/perl isn't that the locally installed version--ie not the deb packaged version? I cant build a deb package because it complains about missing tar files and other stuff.
The build process is sorely lacking. A build process that actually works would be to have a script in the cvs sources called build.sh that would create any needed tarballs and then run debuild. or even better create a Makefile so we can 'make deb'. If it conflicts with the perl makefile move the perl one to a subdirectory.
just my 2 cents.
perl -MDBIWrapper -e 'print $DBIWrapper::VERSION . "\n"'
should tell you what version you are getting picked up.
debuild will complain but you just say yes and it should build itself a tarball.
What other errors are you getting?
I'm currently doing all my builds on a Debian Etch install, so some things may need to be updated to handle newer versions of Debian.
built package. Errror is the same whether dbiwrapper is installed as a package or tarball. (deleted tarball).
DBD::Pg::db last_insert_id failed: No suitable column found for last_insert_id of table "entity_tb" at /usr/share/perl5/DBIWrapper.pm line 2520.
What values are you using in new() for:
printError
raiseError
They default to being on (1).
we don't set them. (You wrote most of the code that we are discussing in SS which calls DBIWrapper). I'm assuming setting them to 0 would turn off all error reporting? If so, what is the point of having error reporting in the first place?
Best practices would suggest fixing the error--not suppressing it.
In this case though, I don't know that the table in question doesn't have a sequence defined and am relying on the DBD::Pg method to figure things out. Suppressing the warning by turning off printError locally is the correct solution.
Why it's not working for you is the question. It works for me in the multiple versions of Perl and DBD::Pg I'm using against multiple versions of PostgreSQL (7, 8, 9).
You could try turning off printError globally in DBIWrapper->new(), but don't turn off raiseError if you are using eval's to trap database errors.