Thread: Problem with Postgres V 8 and DBI maybe

Problem with Postgres V 8 and DBI maybe

From
David Siebert
Date:
I am trying to add records to a table in DBI and I keep getting an error  7
The exact error is DBD::Pg::st execute failed:  at connect.pl line 107.
ERROR!!! (7) INSERT INTO phonegroups VALUES ('TECHIES',1, 1)
I included the statement and when I try it in pgpadmin it works fine.
Any suggestions?

Re: Problem with Postgres V 8 and DBI maybe

From
Michael Fuhr
Date:
On Tue, Jan 25, 2005 at 05:49:11PM -0500, David Siebert wrote:

> I am trying to add records to a table in DBI and I keep getting an error  7
> The exact error is DBD::Pg::st execute failed:  at connect.pl line 107.
> ERROR!!! (7) INSERT INTO phonegroups VALUES ('TECHIES',1, 1)

Hmmm...I don't think DBI or DBD::Pg prints errors like "ERROR!!! (7)".
Are you doing your own error checking and only looking at $DBI::err?
What does $DBI::errstr say?

Have you tried to reduce the problem to the smallest amount of code
necessary to reproduce the problem?  Something like this:

my $dbh = DBI->connect($source, $user, $password, {RaiseError => 1});
my $sth = $dbh->prepare("INSERT INTO phonegroups VALUES (?, ?, ?)");
$sth->execute("TECHIES", 1, 1);
$dbh->disconnect;

--
Michael Fuhr
http://www.fuhr.org/~mfuhr/