[CDBI] Type binding

Matt S Trout dbix-class at trout.me.uk
Thu Jun 8 00:58:14 BST 2006

Bill Moseley wrote:
> On Wed, Jun 07, 2006 at 02:54:10PM -0400, Perrin Harkins wrote:
>> On Tue, 2006-06-06 at 22:19 -0700, Bill Moseley wrote:
>>> I received this error on Postgresql 8.1.3:
>>> : DBD::Pg::st execute failed: ERROR:  invalid input syntax for type boolean: "34696"
>>>  [for Statement "SELECT me.id, me.cart, me.registration, me.transaction_by, me.transaction_time, me.amount, me.transaction_id, me.transaction_type, me.invoice, me.comment
>>> FROM   cart_transaction me
>>> WHERE  ( me.cart = ? )  ORDER BY transaction_time 
>>> " with ParamValues: 1='34696'] at /home/moseley/local/share/perl/5.8.4/DBIx/ContextualFetch.pm line 52.
>>>  at /home/moseley/local/share/perl/5.8.4/Class/DBI/Relationship/HasMany.pm line 144
>>> The query works fine in psql.
>> Try it in vanilla DBI.  It doesn't look like a Class::DBI thing, but
>> it's hard to be sure.  DBI is usually good about guessing data types.
> It's now working after a restart of the mod_perl server.  I suspect
> if I tried it in DBI it would have also worked because it was a new
> process.
> I'm now just curious about what happened to cause the problem to show
> up.

Presumably DBD::Pg caches the column metadata and gets exceedingly 
confused when the schema changes; I believe John Siracusa has run into 
all sorts of fun with DBD::Pg and schema changes in RDBO.

Rule of thumb seems to be "if you change the schema, restart the apps"

More information about the ClassDBI mailing list