I am porting over a Perl script that was using the sqlite3 DBD driver
to now use the Pg one. I'm on CentOS 6.7 using perl-5.10.1-141 and
perl-DBD-Pg-2.15.1 (I know, it's old).

My script has the following SQL statement executed like so:

my $sql = "SELECT col1,col2 FROM tbl WHERE col3 =" . $dbh->quote($var) . ";"

etc.

I am connecting to the database via;

"DBI:Pg:dbname=tapedb;host=localhost;sslmode=allow;", username, "",
{AutoCommit => 0, RaiseError => 1, PrintError => 1, pg_server_prepare
=> 0} etc.

I tried using "sslmode=disbabled" and that had no effect.

Anyway, the first time this query gets execute via:

L723 my $sth = $dbh->prepare($sql);
L724 $sth->execute();

everything works fine, I see the results passed back. Life is good.

However, the second time it executes it throws an exception:

DBD::Pg::st execute failed:  at somescript line 724, <$fref> line 8.
DBD::Pg::st execute failed:  at somescript line 724, <$fref> line 8.
 at somescript line 724

I see no error message. I see nothing in $sth->errstr etc. I also see
no error message generated in my
/var/lib/pgsql/data/pg_log/postgresql-Mon.log log file well.

The $sql string is indeed valid and works fine using the standard
"/usr/bin/psql"command (it's a very simple statement just searching on
a string).

Does anyone here have a CLUE on how I can debug this?

-aps (Alex)

Reply via email to