Michael J Schout wrote:
>
> 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
this is a bug in the scanner, which parses the statement for
placeholders.
It recognizes the following styles as placeholders: '?', ':1', ':foo',
but it does not distiniguish between ':' and '::'.
I'll fix that in the next release.
Edmund
--
Edmund Mergl mailto:E.Mergl@bawue.de
Im Haldenhau 9 http://www.bawue.de/~mergl
70565 Stuttgart fon: +49 711 747503
Germany gsm: +49 171 2645325