geektron has asked for the wisdom of the Perl Monks concerning the following question:

my boss decided to upgrade PostGreSQL on our database server without checking into the repercussions. now, because of changes in the way null strings ( as opposed to explicit NULL values ) are handled, some of our sites are breaking with:

[Tue Apr 6 15:37:04 2004] NewUser.cgi: DBD::Pg::st execute failed: ER +ROR: pg_atoi: zero-length string at /usr/lib/perl5/site_perl/5.8.0/D +BIx/Broker.pm line 575. [Tue Apr 6 15:37:04 2004] NewUser.cgi: Error executing run mode 'real +ly_pay': Cannot execute statement (error 7): ERROR: pg_atoi: zero-le +ngth string

i already tried a quick-hack fix in DBIx::Broker to set values to NULL if the string val in the array was empty. but that's an ugly bandaid, and i need to fix it RIGHT.

none of the postgres client libs are on the machine in question. IIRC, the client libs need to be there ( even if the client isn't explicitly installed ) for the install process to complete. the DB's on one machine, the web app's on another. pretty standard.

so what strategy have others used to get around this? upgrading DBD::Pg is needed anyway; i don't know if it will explicitly fix the issue, but it's a good move in the right direction.

Replies are listed 'Best First'.
Re: upgrading DBD::Pg without client libs
by jfroebe (Parson) on Apr 07, 2004 at 21:56 UTC
Re: upgrading DBD::Pg without client libs
by iburrell (Chaplain) on Apr 07, 2004 at 22:07 UTC
    I am surprised DBD::Pg even works if the client libs aren't present. Perhaps it was linked statically. Or maybe you mean that the libraries and headers for development weren't installed but the shared libraries were. Why can't you install the client development libraries?

    Another option is to build DBD::Pg on another machine with the devel libraries and copy it over. The hard part is finding all the files and installing them in the right place. It is important that you get the same version of the libraries on the build machine as the database server.

    Upgrading DBD::Pg won't fix the problem. It was a change in version 7.3 to not allow empty strings for integer columns. The solution is to not pass empty strings for integer columns.

      That's what I get for about 1 minute of research ;-)

      No one has seen what you have seen, and until that happens, we're all going to think that you're nuts. - Jack O'Neil, Stargate SG-1

      Upgrading DBD::Pg won't fix the problem. It was a change in version 7.3 to not allow empty strings for integer columns. The solution is to not pass empty strings for integer columns.

      well, eventually i should upgrade DBD::Pg, but i combed through the code today and found where the empty strings are passed and fixed them. i was hoping that DBD::Pg would have possibly addressed the issue as well ... oh well.