I see. Good catch.  That makes me want to take the preventative measure of factoring out much of this select-specific processing into its own method. Either a QuerySpecification member -- look at all those extra "select."s OR, to be a little less disruptive, a static member of StatementQuery, preventing any "accidental" use of other StatementQuery members.

BTW, I was reminded while researching this comment that I had intended to eliminate the scan_columns attribute as largely redundant with other parts of the voltXML tree. I'd like to replace it with behavior in AbstractParsedStmt that tracks each query's scans' column references as they are instantiated/resolved in their various AbstractExpression trees on the "other side". Maybe we'll get another chance at that when it gets redone for self-joins.