MDL-50851 core_tag: fix db query failure on oracle