Fix postgresql adapter #columns_for_distinct trimming whitespace it shouldn't

Fixes the regression described in https://github.com/rails/rails/issues/16623 present in 4.0.10rc1 & 4.1.6.rc1. It was introduced by 3d5a2019bcccc6fb01bee4811ca669f4383edb51.
Nested greedy wildcard matches are extremely expensive because they backtrace like crazy. Wouldn't be surprised to see pathological slowness on certain queries.

(Out of scope of this PR, but these can be fixed by using non-greedy qualifiers, or more careful regexp design)