how to get the table names from BinaryOperationExpr of where clause
Question
Hi.
i would like to parse a kind of query like:
select * from a inner join b on a.col1 == b.col1 inner join c on b.col2 == c.col2 where a.col3 = 1 and b.col4 = 5
and i got two *ast.BinaryOperationExpr of the where clause a.col3 = 1 and b.col4 = 5. however, that expression only contained *ast.ColumnNameExpr and *driver.ValueExpr and ignored the *ast.TableSource.
may i know how to get the table names?
thanks
you can take a look at type ColumnName
https://github.com/pingcap/parser/blob/94275e813903b69c6e04bd036959d076afa5b89e/ast/expressions.go#L558-L569
you can take a look at type ColumnName
https://github.com/pingcap/parser/blob/94275e813903b69c6e04bd036959d076afa5b89e/ast/expressions.go#L558-L569
But this will cause many duplicate ColumnName to appear. Is there any way to reduce duplication?