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

Method isNumericZero

pkg/sql/sem/tree/normalize.go:764–776  ·  view source on GitHub ↗

isNumericZero returns true if the datum is a number and equal to zero.

(expr TypedExpr)

Source from the content-addressed store, hash-verified

762// isNumericZero returns true if the datum is a number and equal to
763// zero.
764func (v *NormalizeVisitor) isNumericZero(expr TypedExpr) bool {
765 if d, ok := expr.(Datum); ok {
766 switch t := UnwrapDatum(v.ctx, d).(type) {
767 case *DDecimal:
768 return t.Decimal.Sign() == 0
769 case *DFloat:
770 return *t == 0
771 case *DInt:
772 return *t == 0
773 }
774 }
775 return false
776}
777
778// isNumericOne returns true if the datum is a number and equal to
779// one.

Callers 2

normalizeMethod · 0.80
normalizeMethod · 0.80

Calls 1

UnwrapDatumFunction · 0.85

Tested by

no test coverage detected