and likewise check any tracelogs on the database server, which should show the exact statement received before execution. you may need to turn on such server side detail tracing in the first place, and that will vary depending on you DB engine.
the hardest line to type correctly is: stty erase ^H