lib/bmg/sql/processor/where.rb in bmg-0.16.0.pre.rc1 vs lib/bmg/sql/processor/where.rb in bmg-0.16.0.pre.rc2

- old
+ new

@@ -18,15 +18,20 @@ [sexpr[0], sexpr[1]] + non_falsy.map{|nf| apply(nf) } end end def on_select_exp(sexpr) - pred = @predicate.rename(sexpr.desaliaser(true)) - if sexpr.where_clause - sexpr_p = Predicate.new(sexpr.where_clause.predicate) - sexpr.with_update(:where_clause, [ :where_clause, (sexpr_p & pred).sexpr ]) + if sexpr.group_by_clause + sexpr = builder.from_self(sexpr) + call(sexpr) else - sexpr.with_insert(4, [ :where_clause, pred.sexpr ]) + pred = @predicate.rename(sexpr.desaliaser(true)) + if sexpr.where_clause + sexpr_p = Predicate.new(sexpr.where_clause.predicate) + sexpr.with_update(:where_clause, [ :where_clause, (sexpr_p & pred).sexpr ]) + else + sexpr.with_insert(4, [ :where_clause, pred.sexpr ]) + end end end private