Skip to content

Commit

Permalink
copy expression deps more carefully
Browse files Browse the repository at this point in the history
Signed-off-by: Andres Taylor <[email protected]>
  • Loading branch information
systay committed Feb 6, 2025
1 parent 747c308 commit 007a189
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions go/vt/vtgate/semantics/semantic_table.go
Original file line number Diff line number Diff line change
Expand Up @@ -190,13 +190,15 @@ var ErrNotSingleTable = vterrors.VT13001("should only be used for single tables"

// CopyDependencies copies the dependencies from one expression into the other
func (st *SemTable) CopyDependencies(from, to sqlparser.Expr) {
if ValidAsMapKey(to) {
st.Recursive[to] = st.RecursiveDeps(from)
st.Direct[to] = st.DirectDeps(from)
if ValidAsMapKey(from) {
if typ, found := st.ExprTypes[from]; found {
st.ExprTypes[to] = typ
}
if ValidAsMapKey(to) && ValidAsMapKey(from) {
if ts, ok := st.Recursive[from]; ok {
st.Recursive[to] = ts
}
if ts, ok := st.Direct[from]; ok {
st.Direct[to] = ts
}
if typ, found := st.ExprTypes[from]; found {
st.ExprTypes[to] = typ
}
}
}
Expand Down

0 comments on commit 007a189

Please sign in to comment.