@@ -599,10 +599,7 @@ func QualifyBuiltinFunctionDefinition(
599
599
func GetBuiltinFuncDefinitionOrFail (
600
600
fName RoutineName , searchPath SearchPath ,
601
601
) (* ResolvedFunctionDefinition , error ) {
602
- def , err := GetBuiltinFuncDefinition (fName , searchPath )
603
- if err != nil {
604
- return nil , err
605
- }
602
+ def := GetBuiltinFuncDefinition (fName , searchPath )
606
603
if def == nil {
607
604
forError := fName // prevent fName from escaping
608
605
return nil , errors .Mark (
@@ -634,28 +631,23 @@ func GetBuiltinFunctionByOIDOrFail(oid oid.Oid) (*ResolvedFunctionDefinition, er
634
631
// in the specific schema are searched. Otherwise, all schemas on the given
635
632
// searchPath are searched. A nil is returned if no function is found. It's
636
633
// caller's choice to error out if function not found.
637
- //
638
- // In theory, this function returns an error only when the search path iterator
639
- // errors which won't happen since the iterating function never errors out. But
640
- // error is still checked and return from the function signature just in case
641
- // we change the iterating function in the future.
642
634
func GetBuiltinFuncDefinition (
643
635
fName RoutineName , searchPath SearchPath ,
644
- ) ( * ResolvedFunctionDefinition , error ) {
636
+ ) * ResolvedFunctionDefinition {
645
637
if fName .ExplicitSchema {
646
- return ResolvedBuiltinFuncDefs [fName .Schema ()+ "." + fName .Object ()], nil
638
+ return ResolvedBuiltinFuncDefs [fName .Schema ()+ "." + fName .Object ()]
647
639
}
648
640
649
641
// First try that if we can get function directly with the function name.
650
642
// There is a case where the part[0] of the name is a qualified string when
651
- // the qualified name is double quoted as a single name like "schema.fn".
643
+ // the qualified name is double- quoted as a single name like "schema.fn".
652
644
if def , ok := ResolvedBuiltinFuncDefs [fName .Object ()]; ok {
653
- return def , nil
645
+ return def
654
646
}
655
647
656
648
// Then try if it's in pg_catalog.
657
649
if def , ok := ResolvedBuiltinFuncDefs [catconstants .PgCatalogName + "." + fName .Object ()]; ok {
658
- return def , nil
650
+ return def
659
651
}
660
652
661
653
// If not in pg_catalog, go through search path.
@@ -669,5 +661,5 @@ func GetBuiltinFuncDefinition(
669
661
}
670
662
}
671
663
672
- return resolvedDef , nil
664
+ return resolvedDef
673
665
}
0 commit comments