Search Postgresql Archives

Perl DBI issue

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Folks,

	I just installed a new machine with Fedora Core 4 with PostgreSQL 8.0.3.  I
also installed DBI::Pg 1.41.  When I try to use a query with a placeholder
in it I get the error: "DBD::Pg::st execute failed: ERROR:  syntax error at
or near "$1" at character 1".  The same query with a value instead of a
placeholder works just fine.  The script follows this email.

	I can use exactly the same script to connect to PostgreSQL on this machine
from a different machine, and I can not connect from this machine to a
PostgreSQL install of 7.4.1.  It looks to me like there is some problem
between DBI::Pg and the client library.  While poking around I saw that all
the other machines have a libpq.so, but this new machine doesn't (it has a
libpq.so.4 and libpq.so.4.0 tho).  I don't know if that is significant.

	Any suggestions would be much appreciated.

Thanks,
Peter Darley


#!/usr/bin/perl

use DBI;
use strict;

my ($dbhCheck, $sthCheck, $Result);

$dbhCheck = DBI->connect("dbi:Pg:dbname=neo;host=production", 'user',
'password');
$sthCheck = $dbhCheck->prepare("SELECT COUNT(*) FROM Sample where
SurveyID=?");
$sthCheck->execute(316);
$Result = $sthCheck->fetchrow();
print "Sample has $Result members.\n";
$sthCheck->finish();
$dbhCheck->disconnect();


---------------------------(end of broadcast)---------------------------
TIP 9: In versions below 8.0, the planner will ignore your desire to
       choose an index scan if your joining column's datatypes do not
       match

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux