Merge pull request #16649 from Agis-/pg-columns-for-distinct

Fix postgresql adapter #columns_for_distinct trimming whitespace it shouldn't
CHANGELOG & improvements to #16649

* Require either FIRST or LAST qualifier for "NULLS ..."
* Require whitespace before "NULLS ..."