MCPcopy Create free account
hub / github.com/auxten/postgresql-parser / newBinExprIfValidOverload

Function newBinExprIfValidOverload

pkg/sql/sem/tree/expr.go:1161–1175  ·  view source on GitHub ↗

newBinExprIfValidOverload constructs a new BinaryExpr if and only if the pair of arguments have a valid implementation for the given BinaryOperator.

(op BinaryOperator, left TypedExpr, right TypedExpr)

Source from the content-addressed store, hash-verified

1159// if the pair of arguments have a valid implementation for the given
1160// BinaryOperator.
1161func newBinExprIfValidOverload(op BinaryOperator, left TypedExpr, right TypedExpr) *BinaryExpr {
1162 leftRet, rightRet := left.ResolvedType(), right.ResolvedType()
1163 fn, ok := BinOps[op].lookupImpl(leftRet, rightRet)
1164 if ok {
1165 expr := &BinaryExpr{
1166 Operator: op,
1167 Left: left,
1168 Right: right,
1169 fn: fn,
1170 }
1171 expr.typ = returnTypeToFixedType(fn.returnType(), []TypedExpr{left, right})
1172 return expr
1173 }
1174 return nil
1175}
1176
1177// Format implements the NodeFormatter interface.
1178func (node *BinaryExpr) Format(ctx *FmtCtx) {

Callers 2

normalizeMethod · 0.85
normalizeMethod · 0.85

Calls 4

returnTypeToFixedTypeFunction · 0.85
lookupImplMethod · 0.80
ResolvedTypeMethod · 0.65
returnTypeMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…