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

Method normalize

pkg/sql/sem/tree/normalize.go:63–79  ·  view source on GitHub ↗
(v *NormalizeVisitor)

Source from the content-addressed store, hash-verified

61}
62
63func (expr *IfExpr) normalize(v *NormalizeVisitor) TypedExpr {
64 if v.isConst(expr.Cond) {
65 cond, err := expr.TypedCondExpr().Eval(v.ctx)
66 if err != nil {
67 v.err = err
68 return expr
69 }
70 if d, err := GetBool(cond); err == nil {
71 if d {
72 return expr.TypedTrueExpr()
73 }
74 return expr.TypedElseExpr()
75 }
76 return DNull
77 }
78 return expr
79}
80
81func (expr *UnaryExpr) normalize(v *NormalizeVisitor) TypedExpr {
82 val := expr.TypedInnerExpr()

Callers

nothing calls this directly

Calls 6

TypedCondExprMethod · 0.95
TypedTrueExprMethod · 0.95
TypedElseExprMethod · 0.95
GetBoolFunction · 0.85
EvalMethod · 0.65
isConstMethod · 0.45

Tested by

no test coverage detected