MCPcopy Create free account
hub / github.com/dolthub/doltgresql / defaultTypeCheck

Function defaultTypeCheck

postgres/parser/sem/tree/overload.go:788–808  ·  view source on GitHub ↗

defaultTypeCheck type checks the constant and placeholder expressions without a preference and adds them to the type checked slice.

(
	ctx context.Context, semaCtx *SemaContext, s *typeCheckOverloadState, errorOnPlaceholders bool,
)

Source from the content-addressed store, hash-verified

786// defaultTypeCheck type checks the constant and placeholder expressions without a preference
787// and adds them to the type checked slice.
788func defaultTypeCheck(
789 ctx context.Context, semaCtx *SemaContext, s *typeCheckOverloadState, errorOnPlaceholders bool,
790) error {
791 for _, i := range s.constIdxs {
792 typ, err := s.exprs[i].TypeCheck(ctx, semaCtx, types.Any)
793 if err != nil {
794 return pgerror.Wrapf(err, pgcode.InvalidParameterValue,
795 "error type checking constant value")
796 }
797 s.typedExprs[i] = typ
798 }
799 for _, i := range s.placeholderIdxs {
800 if errorOnPlaceholders {
801 _, err := s.exprs[i].TypeCheck(ctx, semaCtx, types.Any)
802 return err
803 }
804 // If we dont want to error on args, avoid type checking them without a desired type.
805 s.typedExprs[i] = StripParens(s.exprs[i]).(*Placeholder)
806 }
807 return nil
808}
809
810// checkReturn checks the number of remaining overloaded function
811// implementations.

Callers 2

typeCheckOverloadedExprsFunction · 0.85
checkReturnFunction · 0.85

Calls 3

WrapfFunction · 0.92
StripParensFunction · 0.85
TypeCheckMethod · 0.65

Tested by

no test coverage detected