grrr.... it's taken me way too long to sort out why this wasn't working...
We have a PL/pgSQL function that attaches keywords to assets in the database, and were trying to use postgres's function overloading so that you could pass either an asset name or the asset_id to the relevant function and have it do the Right Thing.
Calling o2_keyword_map (:filename, :keyword) worked fine, but when attaching many keywords to one asset I'd rather not have to look up the asset_id from the filename every time, but o2_keyword_map (:asset_id, :keyword) would barf claiming that no such asset existed.
It turns out that the bind variable emulation in nspostgres works by turning everything into a string, and letting PG cast stuff to the correct type if necessary. So when we're passing in an asset_id instead of a filename the actual call that gets delivered to PG is o2_keyword_map ('40519','tism'), which instead of going to o2_asset_map (integer, varchar) instead matches o2_asset_map (varchar, varchar), tries to look up an asset called '40519', and fails.
The easy workaround is to explicitly cast the asset_id to an integer in the PL/pgSQL call, but I can't help wondering if there's a better way.