> m> I don't know if developers of new DBD::Pg have some game plan to fix
> m> this problem... but it won't be easy: since perl is a no-var-type
> m> language, so either DBD::Pg needs to analyze the table columns data
> m> types first before executing a query and then use correct type for
> m> bind values, or let coder pass those types explicitly... though I'm
> m> not aware of a method in DBI that would let them do that...
>
> Wouldn't bind_param() do just that?
>
just looked up DBI man - you are right, bind_param accepts column type...
the question is - does DBD::Pg really process those types ?
Checkout lines
1569 ... 1576 of dbdimp.c - it only checks BYTEAOID, everything else
goes in as varchar :(
While In other place ( line 1682) it analyzes the types... It's
better to double check that with DBD::Pg developer, since I'm not
familiar with its code deeply.
Ideallly a programmer doesn't need to care to specify column type when
putting a code like this (assuming C is of an "int" type ):
my $sth = $dbh->prepare_cached( "select A from B where C=?");
$sth->execute( 123 );
...
and DBD::Pg would guess (don't ask me how) the column types and pass
it to postgresql so the query executed in most efficient way.
With DBD::Pg ver 1.40-1.41, if a programmer didn't specify a column
type, it looks like it gonna be executed by postgresql w/o using
indexes because of the bind values and table fields types conflict.
--
Vlad