Skip Menu |

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

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

People
Owner: Nobody in particular
Requestors: wchao [...] yahoo.com
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: (no value)
Fixed in: (no value)



Subject: Placeholders do not work with timestamp prefix
I am running DBI 1.48 and DBD::Pg 1.42 with Perl 5.6.1 on Red Hat Linux 7.3 to connect to PostgreSQL 8.0.0. The following statements cause problems: 2005-06-17 16:21:41 EDT LOG: statement: select * from reservation_tbl where room_id = $1 and (start_dt, end_dt) overlaps (timestamp $2, timestamp $3) 2005-06-17 16:21:41 EDT ERROR: syntax error at or near "$2" at character 93 2005-06-17 16:21:41 EDT LOG: statement: insert into reservation_tbl (room_id, account_id, start_dt, end_dt, note) values ($1, $2, timestamp $3, timestamp $4, $5) 2005-06-17 16:21:41 EDT ERROR: syntax error at or near "$3" at character 101 I think it is something to do with the "timestamp" keyword interacting badly with placeholders. I am not sure if it is a DBD::Pg problem or a PostgreSQL problem. I lean towards the problem being in PostgreSQL's parser, but I am posting it here just in case it is a DBD::Pg problem.
From: Wellie Chao
I think the problem is with DBI or the DBD::Pg module (see below for the prognosis by a PostgreSQL developer). Show quoted text
-----Original Message----- From: Tom Lane Sent: Saturday, June 18, 2005 1:54 AM To: Wellie Chao Subject: Re: [BUGS] BUG #1720: placeholders do not work with timestamp prefix "Wellie Chao" writes:
> I am using DBI 1.48 and DBD::Pg 1.42 (the programming language is
obviously
> Perl) to connect to PostgreSQL 8.0.0. The following statements cause > problems:
> 2005-06-17 16:21:41 EDT LOG: statement: select * from reservation_tbl
where
> room_id = $1 and (start_dt, end_dt) overlaps (timestamp $2, timestamp $3) > 2005-06-17 16:21:41 EDT ERROR: syntax error at or near "$2" at character > 93
The above is not valid SQL --- the notation "timestamp x" is only legal when x is a simple string literal. I think you need to complain to the DBI or DBD::Pg folk, if their code is generating this query. regards, tom lane [guest - Fri Jun 17 17:35:12 2005]:
> I am running DBI 1.48 and DBD::Pg 1.42 with Perl 5.6.1 on Red Hat > Linux 7.3 to connect to PostgreSQL 8.0.0. The following statements > cause > problems: > > 2005-06-17 16:21:41 EDT LOG: statement: select * from reservation_tbl > where room_id = $1 and (start_dt, end_dt) overlaps (timestamp $2, > timestamp $3) > 2005-06-17 16:21:41 EDT ERROR: syntax error at or near "$2" at > character 93 > 2005-06-17 16:21:41 EDT LOG: statement: insert into reservation_tbl > (room_id, account_id, start_dt, end_dt, note) values ($1, $2, > timestamp $3, timestamp $4, $5) > 2005-06-17 16:21:41 EDT ERROR: syntax error at or near "$3" at > character 101 > > I think it is something to do with the "timestamp" keyword interacting > badly with placeholders. I am not sure if it is a DBD::Pg problem > or a PostgreSQL problem. I lean towards the problem being in > PostgreSQL's parser, but I am posting it here just in case it is a > DBD::Pg problem.