diff --git a/go/vt/vtgate/planbuilder/operators/SQL_builder.go b/go/vt/vtgate/planbuilder/operators/SQL_builder.go index 1f6ce10b99e..3972ac8290a 100644 --- a/go/vt/vtgate/planbuilder/operators/SQL_builder.go +++ b/go/vt/vtgate/planbuilder/operators/SQL_builder.go @@ -135,6 +135,8 @@ func (qb *queryBuilder) addPredicate(expr sqlparser.Expr) { case *sqlparser.Delete: addPred = stmt.AddWhere case nil: + // this would happen if we are adding a predicate on a dual query. + // we use this when building recursive CTE queries sel := &sqlparser.Select{} addPred = sel.AddWhere qb.stmt = sel