MCPcopy Create free account
hub / github.com/cockroachdb/cockroachdb-parser / newDecimal

Function newDecimal

pkg/sql/parser/parse.go:487–495  ·  view source on GitHub ↗

newDecimal creates a type for DECIMAL with the given precision and scale.

(prec, scale int32)

Source from the content-addressed store, hash-verified

485
486// newDecimal creates a type for DECIMAL with the given precision and scale.
487func newDecimal(prec, scale int32) (*types.T, error) {
488 if scale > prec {
489 err := pgerror.WithCandidateCode(
490 errors.Newf("scale (%d) must be between 0 and precision (%d)", scale, prec),
491 pgcode.InvalidParameterValue)
492 return nil, err
493 }
494 return types.MakeDecimal(prec, scale), nil
495}
496
497// arrayOf creates a type alias for an array of the given element type and fixed
498// bounds. The bounds are currently ignored.

Callers

nothing calls this directly

Calls 2

WithCandidateCodeFunction · 0.92
MakeDecimalFunction · 0.92

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…