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