Fix internal compiler error: expand SELECT pattern