On Fri, 13 Feb 2004, Ian Knopke wrote:
> 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.
Not really. You just need to tell DBD::Pg what data type to use when
binding the column.
> 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!
>
Yes. $sth->bind_param(":param", $datum, SQL_INTEGER) should work. Note
that there is no "{TYPE=>...}" Just the bare SQL_INTEGER. There is a bug
in DBD::Pg < 1.32_1 where it would not let you specify an SQL type using
{TYPE=>}, and thow an error stating that you cannot specify both sql type
and pg type.
Did you import the sql types into your namespace and are you using strict?
Because if you don't have the types imported, you will not be passing a
type that DBD::Pg knows about.
Rudy