Prevent relation builder from generating NULL for array of ranges

Patch fixing issue #9171 on master