Hi.
Im running Postgresql v6.2, perl5.004_04, the latest DBI, and the latest
DBD::Pg (0.69). I have a script that just executes a query, and tries to
get the results, and it seems that this particular query doesnt work. Here
is the code that does not work with DBD::Pg.
use strict;
use DBI;
my $dbh = DBI->connect("dbi:Pg:dbname=gkgis");
my $query;
$query = "SELECT project, user, created, ";
$query .= " 'now'::datetime-datetime(created) AS otime ";
$query .= "FROM project_todo ";
$query .= "WHERE openincident='TRUE' ";
$query .= "ORDER BY created";
print "QUERY : $query";
my $sth = $dbh->prepare($query);
my $rc = $sth->execute();
This produces no accessible results! I know the query is okay because I
can cut and paste teh query (that the script prints) into a psql session
and it dumps out the results.
What makes me think its a bug in DBD is that if I change the above script
to have:
my $query = "SELECT * FROM project_todo";
...
instead of the long query above, it produces results. So the connection
part is okay (ie access is granted etc). If I use Pg instead of DBI the
long query works, but I would prefer to use DBI. Does anyone have any
ideas what would cause this? Its a quite strange problem, adn I dont know
how to debug DBD::Pg :)
Mike