join: Don't add delimiter if only null-values are left

Looks like a nested loop that introduces polinomial complexity,
but the inner loop advances the outer loop as well.

Fixes Redmine #6552
(cherry picked from commit db3ac8257edc35578e8124dab11891ce8a340076)
Changelog entry for 6552