dolthub / vitess

Vitess is a database clustering system for horizontal scaling of MySQL.
http://vitess.io
Apache License 2.0
23 stars 22 forks source link

Include the With clause in walked subtrees for Select statements #284

Closed fulghum closed 1 year ago

fulghum commented 1 year ago

We weren't walking the With clause for select statements, which caused us to not find any bind vars in use there.

Related to: https://github.com/dolthub/dolt/issues/6852

fulghum commented 1 year ago

The only potential issue is that I thought string formatting used the subtree walk to round trip string -> AST -> string. So if that worked before, I'm wondering if we need to delete something from the SELECT stringer

Thanks for raising the potential concern. I poked around at this a bit and I don't think there are any issues. The Walk function is only used in a few places. The only use in Vitess is to identify bind vars, then we have a couple uses in GMS: one for finding bind vars, and one that searches for AliasedTableExpr, and one in the analyzeHaving function. I didn't see any problems with those usages and will keep an eye on the GMS and Dolt tests as this goes through.