From a891d3f6359dcd6fa99ec3588c05fc780bbe6fb1 Mon Sep 17 00:00:00 2001 From: Daylon Wilkins Date: Mon, 8 Jul 2024 04:05:27 -0700 Subject: [PATCH] Added IN to indexes --- server/analyzer/indexes.go | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/server/analyzer/indexes.go b/server/analyzer/indexes.go index de27eed37f..4940767382 100644 --- a/server/analyzer/indexes.go +++ b/server/analyzer/indexes.go @@ -55,6 +55,10 @@ func IndexLeafChildren(e sql.Expression) (analyzer.IndexScanOp, sql.Expression, default: return 0, nil, nil, false } + case *pgexprs.InTuple: + op = analyzer.IndexScanOpInSet + left = expr.Left() + right = expr.Right() default: return 0, nil, nil, false } @@ -76,6 +80,13 @@ func IndexLeafChildren(e sql.Expression) (analyzer.IndexScanOp, sql.Expression, } rightType, ok := right.Type().(pgtypes.DoltgresType) if !ok { + if tuple, ok := right.(expression.Tuple); ok { + newTuple := make(expression.Tuple, len(tuple)) + for i := range tuple { + newTuple[i] = pgexprs.NewExplicitCast(tuple[i], leftType) + } + return op, left, newTuple, true + } return 0, nil, nil, false } if !leftType.Equals(rightType) {