Skip to content

Commit bdd826a

Browse files
author
James Cor
committed
restore behavior
1 parent d728d6a commit bdd826a

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

sql/memo/rel_props.go

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -133,11 +133,12 @@ func newRelProps(rel RelExpr) *relProps {
133133
// idxExprsColumns returns the column names used in an index's expressions.
134134
// Identifiers are ambiguous.
135135
func idxExprsColumns(idx sql.Index) []string {
136-
columns := idx.Expressions()
137-
for i := 0; i < len(columns); i++ {
138-
columns[i] = strings.ToLower(columns[i][strings.IndexByte(columns[i], '.')+1:])
136+
exprs := idx.Expressions()
137+
for i, e := range exprs {
138+
colName := e[strings.IndexByte(e, '.')+1:]
139+
exprs[i] = strings.ToLower(colName)
139140
}
140-
return columns
141+
return exprs
141142
}
142143

143144
func (p *relProps) SetStats(s sql.Statistic) {
@@ -791,8 +792,12 @@ func sortedColsForRel(rel RelExpr) sql.Schema {
791792
var ret sql.Schema
792793
for _, e := range r.InnerScan.Table.Index().Expressions() {
793794
// TODO columns can have "." characters, this will miss cases
795+
idx := strings.IndexRune(e, '.')
796+
if idx == -1 {
797+
return nil
798+
}
794799
ret = append(ret, &sql.Column{
795-
Name: strings.ToLower(e),
800+
Name: strings.ToLower(e[idx+1:]),
796801
Source: strings.ToLower(r.InnerScan.Table.Name()),
797802
Nullable: true},
798803
)

0 commit comments

Comments
 (0)