I can reproduce the glitch with the union example, but couldn't find any documentation on the use of 'DYDY'
to get day names. That said, an array-based approach might be faster than traversing the if else block
select current_timestamp as ct,dayofweek(ct) as dow,['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'][dow]::varchar