Skip Menu |

This queue is for tickets about the DBD-Pg CPAN distribution.

Report information
The Basics
Id: 15320
Status: resolved
Priority: 0/
Queue: DBD-Pg

People
Owner: Nobody in particular
Requestors: jgallagher [...] texoma.net
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: 1.43
Fixed in: 1.43



Subject: Executing Prepared Statement Fails with Syntax Error
DBI Version: 1.48 DBD::Pg Version: 1.43 Using perl from Fedora Core 4: perl -v: This is perl, v5.8.6 built for i386-linux-thread-multi uname -a: Linux 2.6.11-1.1369_FC4smp #1 SMP Thu Jun 2 23:08:39 EDT 2005 i686 i686 i386 GNU/Linux The following succeeds: $sth = $dbh->prepare(q[select timezone('zulu',?)]); $sth->execute('2005-10-26 12:00:00 CST'); print "Got " . $sth->fetchrow_arrayref->[0] . "\n"; # Prints "2005-10-26 18:00:00" The following fails: $sth = $dbh->prepare(q[select extract(epoch from timestamp with time zone ?)]); $sth->execute('2005-10-26 12:00:00 CST'); with error DBD::Pg::st execute failed: ERROR: syntax error at or near "$1" at character 52
This is a true syntax error as reported by PostgreSQL, which is strict about what statements it can prepare. You can rewrite your statement as: select extract(epoch from ?::timestamptz)