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

Function checkCompatibleTypes

server/connection_data.go:228–236  ·  view source on GitHub ↗

checkCompatibleTypes checks if multiple types for which a parameter are used are compatible.

(ctx *sql.Context, existingOid, newOid uint32, newName string)

Source from the content-addressed store, hash-verified

226
227// checkCompatibleTypes checks if multiple types for which a parameter are used are compatible.
228func checkCompatibleTypes(ctx *sql.Context, existingOid, newOid uint32, newName string) error {
229 var err error
230 existing := pgtypes.GetTypeByID(id.Type(id.Cache().ToInternal(existingOid)))
231 newType := pgtypes.GetTypeByID(id.Type(id.Cache().ToInternal(newOid)))
232 if _, _, err = framework.FindCommonType(ctx, []*pgtypes.DoltgresType{existing, newType}); err != nil {
233 err = errors.Errorf("parameter %s is used for incompatible types: %s and %s", newName, existing.String(), newType.String())
234 }
235 return err
236}

Callers 1

extractBindVarTypesFunction · 0.85

Calls 6

TypeTypeAlias · 0.92
CacheFunction · 0.92
FindCommonTypeFunction · 0.92
ToInternalMethod · 0.80
ErrorfMethod · 0.65
StringMethod · 0.65

Tested by

no test coverage detected