There is a bug in the postgres adapter that causes incorrect results
to be returned when there are multiple entries in the search path
(i.e., postgres "SHOW search_path"). This bug has been reported at
least 2 other times in the past (http://dev.rubyonrails.org/ticket/
5906 and http://dev.rubyonrails.org/ticket/3125). It's a simple bug
where an space is being inadvertently added to a quoted query string.
My simple patch includes both test cases that demonstrate the problem
as well as the actual fix to the problem: