I think this is a problem with perl and data type conversion. I believe
that a number (7) is getting inserted into a bound statement as ('7'),
which is causing an error. Database is PostGreSQL 7.3.4.
-------
Here is the code, which breaks:
$dbh_sth{rawlist}=$dbh->prepare("select raw_id,
raw_x,raw_url from raw where raw_id > ? order by
raw_id limit ?");
$maxid=0;
$limit=7;
my $entries=$dbh_sth{rawlist}->execute($maxid,$limit);
-------
Here is the output from dbitrace.log, which contains the error message:
-> execute for DBD::Pg::st (DBI::st=HASH(0x83fc644)~0x83fb4e8 '0' 7)
thr#815cf18
dbd_bind_ph
bind $1 <== '0' (type 0)
dbd_bind_ph
bind $2 <== 7 (type 0)
dbd_st_execute
dbd_st_execute: statement = >
select raw_id, raw_x,raw_url from raw where raw_id >
'0' order by raw_id limit '7'<
ERROR: parser: parse error at or near "'7'" at character 170 error 7
recorded: ERROR: parser: parse error at or near "'7'" at character 170
!! ERROR: 7 'ERROR: parser: parse error at or near "'7'" at character
170'
Is there a way to force PostGreSQL to use a specific data type? I tried
$dbh_sth{rawlist}->bind_param(2,$maxid,{TYPE=>SQL_INTEGER}) before the
execute, but it says that this isn't a PostGreSQL datatype, which makes no
sense to me!
Ian