I've created small patches for myself by replacing all related queries in the 'tools' section with CASTs to CHARs and VARCHARs and would like to contribute these to the community in case anyone else can confirm this is a bug.
I see the same problem with your script in my environment; this certainly seems like a bug to me. I think it would be much appreciated if you could contribute the test case and your fixes.
thanks, bryan
