Normally, literals are inside the first quotes. IE: raise notice ' blah_history.original_id' %', r;
But a compiler doesn't care about human concepts like "normally" - it just cares about "syntactically correct" and as David and Tom observe the original post as visually observed is correct. Which leads one to think that reality and the original post somehow don't match, or as Tom said what the server sees and what is sent end up being different (client encoding issues or some such).
And pretty sure "r" being NULL just puts an empty string where the % is.
David J.