Fixed sql query escapes enumeration