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

Function newDecimal

pkg/sql/parser/parse.go:349–357  ·  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

347
348// newDecimal creates a type for DECIMAL with the given precision and scale.
349func newDecimal(prec, scale int32) (*types.T, error) {
350 if scale > prec {
351 err := pgerror.WithCandidateCode(
352 errors.Newf("scale (%d) must be between 0 and precision (%d)", scale, prec),
353 pgcode.InvalidParameterValue)
354 return nil, err
355 }
356 return types.MakeDecimal(prec, scale), nil
357}
358
359// ArrayOf creates a type alias for an array of the given element type and fixed
360// bounds.

Callers 1

ParseMethod · 0.85

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…